本文整理汇总了PHP中WPTOUCH_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:PHP WPTOUCH_DEBUG函数的具体用法?PHP WPTOUCH_DEBUG怎么用?PHP WPTOUCH_DEBUG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WPTOUCH_DEBUG函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foundation_advertising_init
function foundation_advertising_init()
{
if (!foundation_advertising_enabled()) {
return;
}
$settings = foundation_get_settings();
// Can't use WP is_single(), etc. functions here
if ($settings->advertising_blog_listings || $settings->advertising_single || $settings->advertising_pages || $settings->advertising_taxonomy || $settings->advertising_search) {
switch ($settings->advertising_location) {
case 'footer':
add_action('wptouch_advertising_bottom', 'foundation_handle_advertising');
break;
case 'header':
add_action('wptouch_advertising_top', 'foundation_handle_advertising');
break;
case 'top-content':
add_filter('the_content', 'foundation_handle_advertising_content_top');
break;
case 'bottom-content':
add_filter('the_content', 'foundation_handle_advertising_content_bottom');
break;
default:
WPTOUCH_DEBUG(WPTOUCH_WARNING, 'Unknown advertising location: ' . $settings->advertising_location);
break;
}
}
}
示例2: do_api_request
function do_api_request($method, $command, $params = array(), $do_auth = false)
{
$url = BNC_API_URL . "/{$method}/{$command}/";
// Always use the PHP serialization method for data
$params['format'] = 'php';
if (is_multisite()) {
$params['multisite'] = 1;
$params['site_id'] = get_current_blog_id();
$params['network_activated'] = is_plugin_active_for_network(WPTOUCH_PLUGIN_SLUG) ? '1' : '0';
$params['network_controlled'] = wptouch_is_controlled_network() ? '1' : '0';
} else {
$params['multisite'] = 0;
}
if ($do_auth && $this->might_have_license) {
// Sort the parameters
ksort($params);
// Generate a string to use for authorization
$auth_string = '';
foreach ($params as $key => $value) {
$auth_string = $auth_string . $key . $value;
}
WPTOUCH_DEBUG(WPTOUCH_INFO, 'Auth string [' . $auth_string . '], Key [' . $this->license_key . ']');
// Create the authorization hash using the server nonce and the license key
$params['auth'] = md5($auth_string . $this->license_key);
}
$body_params = array();
foreach ($params as $key => $value) {
$body_params[] = $key . '=' . urlencode($value);
}
$body = implode('&', $body_params);
$options = array('method' => 'POST', 'timeout' => BNC_API_TIMEOUT, 'body' => $body);
$options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'Content-Length' => strlen($body), 'User-Agent' => 'WordPress/' . get_bloginfo("version") . '/WPtouch-Pro/' . WPTOUCH_VERSION, 'Referer' => get_bloginfo("url"));
$this->attempts++;
WPTOUCH_DEBUG(WPTOUCH_INFO, 'Attempting to connect to URL: ' . $url);
$raw_response = wp_remote_request($url, $options);
if (!is_wp_error($raw_response)) {
if ($raw_response['response']['code'] == 200) {
// echo "\n\n" . $raw_response[ 'body' ] . "\n\n"; die;
$result = unserialize($raw_response['body']);
$this->response_code = $result['code'];
return $result;
} else {
WPTOUCH_DEBUG(WPTOUCH_WARNING, "Unable to connect to server. Response code is " . $raw_response['response']['code']);
return false;
}
} else {
$this->server_down = true;
return false;
}
}
示例3: do_api_request
function do_api_request($method, $command, $params = array(), $do_auth = false)
{
$url = BNC_API_URL . "/{$method}/{$command}/";
// Always use the PHP serialization method for data
$params['format'] = 'php';
/*
if ( !$this->bncid || !$this->license_key ) {
return false;
}
*/
if ($do_auth && $this->might_have_license) {
// Add the timestamp into the request, offseting it by the difference between this server's time and the BNC server's time
$params['timestamp'] = time() + $this->time_variance;
// Sort the parameters
ksort($params);
// Generate a string to use for authorization
$auth_string = '';
foreach ($params as $key => $value) {
$auth_string = $auth_string . $key . $value;
}
WPTOUCH_DEBUG(WPTOUCH_INFO, 'Auth string [' . $auth_string . '], Key [' . $this->license_key . ']');
// Create the authorization hash using the server nonce and the license key
$params['auth'] = md5($auth_string . $this->license_key);
}
$body_params = array();
foreach ($params as $key => $value) {
$body_params[] = $key . '=' . urlencode($value);
}
$body = implode('&', $body_params);
$options = array('method' => 'POST', 'timeout' => BNC_API_TIMEOUT, 'body' => $body);
$options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'Content-Length' => strlen($body), 'User-Agent' => 'WordPress/' . get_bloginfo("version") . '/WPtouch-Pro', 'Referer' => get_bloginfo("url"));
$this->attempts++;
$raw_response = wp_remote_request($url, $options);
if (!is_wp_error($raw_response)) {
if ($raw_response['response']['code'] == 200) {
$result = unserialize($raw_response['body']);
$this->response_code = $result['code'];
return $result;
} else {
WPTOUCH_DEBUG(WPTOUCH_WARNING, "Unable to connect to server. Response code is " . $raw_response['response']['code']);
return false;
}
} else {
$this->server_down = true;
return false;
}
}
示例4: wptouch_check_api
function wptouch_check_api()
{
global $wptouch_pro;
$wptouch_pro->setup_bncapi();
$bnc_settings = wptouch_get_settings('bncid');
WPTOUCH_DEBUG(WPTOUCH_INFO, 'Checking BNC API to make sure it is working properly');
$now = time();
if ($now > $bnc_settings->next_update_check_time) {
WPTOUCH_DEBUG(WPTOUCH_INFO, '...performing update');
$result = $wptouch_pro->bnc_api->check_api();
if (isset($result['has_valid_license'])) {
if (!$result['has_valid_license']) {
WPTOUCH_DEBUG(WPTOUCH_INFO, '...DOES NOT appear to have a valid license');
if ($bnc_settings->license_accepted) {
$bnc_settings->failures = $bnc_settings->failures + 1;
WPTOUCH_DEBUG(WPTOUCH_INFO, '......this is failure #' . $bnc_settings->failures);
if ($bnc_settings->failures >= WPTOUCH_API_CHECK_FAILURES) {
$bnc_settings->failures = 0;
$bnc_settings->license_accepted = false;
$bnc_settings->license_accepted_time = 0;
$bnc_settings->save();
}
}
} else {
WPTOUCH_DEBUG(WPTOUCH_INFO, '...user DOES HAVE a valid license');
$bnc_settings->failures = 0;
$bnc_settings->license_accepted = true;
$bnc_settings->license_accepted_time = $now;
}
} else {
WPTOUCH_DEBUG(WPTOUCH_INFO, '...no info? ' . print_r($result, true));
}
WPTOUCH_DEBUG(WPTOUCH_INFO, '...saving updated BNCID settings' . print_r($bnc_settings, true));
$bnc_settings->next_update_check_time = $now + WPTOUCH_API_CHECK_INTERVAL;
$bnc_settings->save();
}
}
示例5: wptouch_free_upgrade_plugin
function wptouch_free_upgrade_plugin()
{
global $wptouch_pro;
$wptouch_pro->bnc_api = false;
$settings = wptouch_get_settings('bncid');
$wptouch_pro->setup_bncapi($settings->bncid, $settings->wptouch_license_key, true);
$bnc_api = $wptouch_pro->get_bnc_api();
$plugin_name = 'wptouch/wptouch.php';
// Check for WordPress 3.0 function
if (function_exists('is_super_admin')) {
$option = get_site_transient('update_plugins');
} else {
$option = function_exists('get_transient') ? get_transient('update_plugins') : get_option('update_plugins');
}
$version_available = false;
$latest_info = $bnc_api->get_product_version();
if ($latest_info && $latest_info['version'] != WPTOUCH_VERSION) {
WPTOUCH_DEBUG(WPTOUCH_INFO, 'A new product update is available [' . $latest_info['version'] . ']');
if (isset($latest_info['upgrade_url']) && wptouch_has_license()) {
if (!isset($option->response[$plugin_name])) {
$option->response[$plugin_name] = new stdClass();
}
// Update upgrade options
$option->response[$plugin_name]->url = 'http://www.wptouch.com/';
$option->response[$plugin_name]->package = $latest_info['upgrade_url'];
$option->response[$plugin_name]->new_version = $latest_info['version'];
$option->response[$plugin_name]->id = '0';
$option->response[$plugin_name]->slug = WPTOUCH_ROOT_NAME;
} else {
if (is_object($option) && isset($option->response)) {
unset($option->response[$plugin_name]);
}
}
$wptouch_pro->latest_version_info = $latest_info;
$upgrade_available = $latest_info['version'];
} else {
if (is_object($option) && isset($option->response)) {
unset($option->response[$plugin_name]);
}
}
if (isset($option->response[$plugin_name])) {
// WordPress 3.0 changed some stuff, so we check for a WP 3.0 function
if (function_exists('is_super_admin')) {
set_site_transient('update_plugins', $option);
} else {
if (function_exists('set_transient')) {
set_transient('update_plugins', $option);
}
}
// Do Upgrade
include_once ABSPATH . 'wp-admin/includes/admin.php';
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$upgrader = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
$upgrader->upgrade('wptouch/wptouch.php');
if (is_array($upgrader->skin->result)) {
deactivate_plugins('wptouch/wptouch.php');
$new_plugin_identifier = 'wptouch-pro/wptouch-pro.php';
$active_plugins = get_option('active_plugins', array());
if (!in_array($new_plugin_identifier, $active_plugins)) {
$active_plugins[] = $new_plugin_identifier;
update_option('active_plugins', $active_plugins);
}
return '1';
} else {
return '0';
}
} else {
return '0';
}
}
示例6: wptouch_admin_handle_ajax
//.........这里部分代码省略.........
}
break;
case 'wizard-multisite':
$settings = $wptouch_pro->get_settings('bncid');
if ($wptouch_pro->post['multisite_control'] == 'true') {
$wptouch_pro->post['multisite_control'] = 1;
} else {
$wptouch_pro->post['multisite_control'] = 0;
}
$settings->multisite_control = $wptouch_pro->post['multisite_control'];
$settings->save();
break;
case 'network-wizard-complete':
$settings = $wptouch_pro->get_settings();
$settings->show_network_wizard = false;
$settings->save();
break;
case 'wizard-complete':
$settings = $wptouch_pro->get_settings();
if (defined('WPTOUCH_IS_FREE')) {
$settings->show_free_wizard = false;
} else {
$settings->show_wizard = false;
}
$settings->save();
break;
case 'activate-license-key':
$email = $wptouch_pro->post['email'];
$key = $wptouch_pro->post['key'];
$settings = wptouch_get_settings('bncid');
$old_settings = $settings;
$settings->bncid = $email;
$settings->wptouch_license_key = $key;
WPTOUCH_DEBUG(WPTOUCH_INFO, "Attempting site activation with email [" . $email . "] and key [" . $key . "]");
$settings->save();
$wptouch_pro->bnc_api = false;
$wptouch_pro->setup_bncapi($email, $key, true);
// let's try to activate the license
$wptouch_pro->activate_license();
// Check to see if the credentials were valid
if ($wptouch_pro->bnc_api->response_code >= 406 && $wptouch_pro->bnc_api->response_code <= 408) {
WPTOUCH_DEBUG(WPTOUCH_WARNING, "Activation response code was [" . $wptouch_pro->bnc_api->response_code . "]");
echo '2';
} else {
if ($wptouch_pro->bnc_api->server_down) {
// Server is unreachable for some reason
WPTOUCH_DEBUG(WPTOUCH_WARNING, "Activation response code was [SERVER UNREACHABLE]");
echo '4';
} else {
if ($wptouch_pro->bnc_api->verify_site_license()) {
// Activation successful
WPTOUCH_DEBUG(WPTOUCH_WARNING, "Activation successful, response code was [" . $wptouch_pro->bnc_api->response_code . "]");
$settings = wptouch_get_settings('bncid');
$settings->license_accepted = 1;
$settings->license_accepted_time = time();
$settings->save();
echo '1';
} else {
$bnc_info = $wptouch_pro->bnc_api->check_api();
if (isset($bnc_info['license_expired']) && $bnc_info['license_expired']) {
WPTOUCH_DEBUG(WPTOUCH_WARNING, "Failure: license is expired [" . $wptouch_pro->bnc_api->response_code . "]");
echo '5';
} else {
// No more licenses - might be triggered another way
WPTOUCH_DEBUG(WPTOUCH_WARNING, "Failure: activation response code was [" . $wptouch_pro->bnc_api->response_code . "]");
echo '3';
示例7: wptouch_recursive_copy
function wptouch_recursive_copy($source_dir, $dest_dir)
{
$src_dir = @opendir($source_dir);
if ($src_dir) {
while (($f = readdir($src_dir)) !== false) {
if ($f == '.' || $f == '..') {
continue;
}
$cur_file = $source_dir . '/' . $f;
if (is_dir($cur_file)) {
if (!wp_mkdir_p($dest_dir . '/' . $f)) {
WPTOUCH_DEBUG(WPTOUCH_WARNING, "Unable to create directory " . $dest_dir . '/' . $f);
}
wptouch_recursive_copy($source_dir . '/' . $f, $dest_dir . '/' . $f);
} else {
$dest_file = $dest_dir . '/' . $f;
$src = @fopen($cur_file, 'rb');
if ($src) {
$dst = fopen($dest_file, 'w+b');
if ($dst) {
while (!feof($src)) {
$contents = fread($src, 8192);
fwrite($dst, $contents);
}
fclose($dst);
} else {
WPTOUCH_DEBUG(WPTOUCH_ERROR, 'Unable to open ' . $dest_file . ' for writing');
}
fclose($src);
} else {
WPTOUCH_DEBUG(WPTOUCH_ERROR, 'Unable to open ' . $cur_file . ' for reading');
}
}
}
closedir($src_dir);
}
}
示例8: wptouch_plugins_disable
function wptouch_plugins_disable($wptouch_pro, $settings)
{
foreach ($settings->plugin_hooks as $name => $hook_info) {
if ($name == 'ignore') {
continue;
}
if (isset($settings->enabled_plugins[$name]) && !$settings->enabled_plugins[$name]) {
if ($name == 'jetpack') {
// Likes
remove_filter('the_content', array('Jetpack_Likes', 'post_likes'), 30, 1);
remove_filter('post_flair', array('Jetpack_Likes', 'post_likes'), 30, 1);
remove_filter('wp_footer', array('Jetpack_Likes', 'likes_master'));
remove_action('init', array('Jetpack_Likes', 'action_init'));
// Sharing
remove_filter('the_content', 'sharing_display', 19);
remove_filter('the_excerpt', 'sharing_display', 19);
add_filter('option_sharedaddy_disable_resources', 'wptouch_return_false');
add_filter('sharing_show', 'wptouch_return_false');
// Related Posts
add_action('wp', 'wptouch_remove_jetpack_related');
}
if (isset($hook_info->filters) && count($hook_info->filters)) {
foreach ($hook_info->filters as $hooks) {
WPTOUCH_DEBUG(WPTOUCH_VERBOSE, "Disable filter [" . $hooks->hook . "] with function [" . $hooks->hook_function . "]");
if ($hooks->priority) {
remove_filter($hooks->hook, $hooks->hook_function, $hooks->priority);
} else {
remove_filter($hooks->hook, $hooks->hook_function);
}
}
}
if (isset($hook_info->actions) && count($hook_info->actions)) {
foreach ($hook_info->actions as $hooks) {
WPTOUCH_DEBUG(WPTOUCH_VERBOSE, "Disable action [" . $hooks->hook . "] with function [" . $hooks->hook_function . "]");
if ($hooks->priority) {
remove_action($hooks->hook, $hooks->hook_function, $hooks->priority);
} else {
remove_action($hooks->hook, $hooks->hook_function);
}
}
}
}
}
}
示例9: save_settings
function save_settings($settings, $domain = 'wptouch_pro')
{
if ($domain == 'wptouch_pro') {
$settings = apply_filters('wptouch_update_settings', $settings);
}
// 3.0 domain specific filtering
$settings = apply_filters('wptouch_update_settings_domain', $settings, $domain);
if ($domain == 'bncid') {
WPTOUCH_DEBUG(WPTOUCH_VERBOSE, 'Saving settings to database with domain ' . $domain . " " . print_r($settings, true));
}
// Save the old domain
$old_domain = $settings->domain;
unset($settings->domain);
// From development
if (isset($settings->site_wide)) {
unset($settings->site_wide);
}
$setting_name = $this->get_wp_setting_name_for_domain($domain);
if ($this->is_domain_site_wide($domain)) {
WPTOUCH_DEBUG(WPTOUCH_VERBOSE, 'Saving site wide option for domain ' . $domain);
update_site_option($setting_name, $settings);
} else {
WPTOUCH_DEBUG(WPTOUCH_VERBOSE, 'Saving non-site wide option for domain ' . $domain);
update_option($setting_name, $settings);
}
// Restore old domain
$settings->domain = $old_domain;
require_once WPTOUCH_DIR . '/core/menu.php';
$this->settings_objects[$domain] = $settings;
do_action('wptouch_update_settings_domain_' . $domain);
}
示例10: wptouch_settings_process
function wptouch_settings_process($wptouch_pro)
{
if (isset($wptouch_pro->post['wptouch-reset-3'])) {
$wptouch_pro->verify_post_nonce();
// Clear the cookie
setcookie('wptouch-admin-menu', 0, time() - 3600);
WPTOUCH_DEBUG(WPTOUCH_INFO, "Settings are being reset");
$wptouch_pro->erase_all_settings();
$wptouch_pro->reset_icon_states();
$wptouch_pro->reload_settings();
require_once WPTOUCH_DIR . '/core/menu.php';
// Check for multisite reset
if (wptouch_is_multisite_enabled() && wptouch_is_multisite_primary()) {
delete_site_option(WPTOUCH_MULTISITE_LICENSED);
}
$wptouch_pro->redirect_to_page(admin_url('admin.php?page=wptouch-admin-touchboard'));
wptouch_delete_all_transients();
} else {
if (isset($wptouch_pro->post['wptouch-submit-3'])) {
$wptouch_pro->verify_post_nonce();
if (isset($wptouch_pro->post['wptouch_restore_settings']) && strlen($wptouch_pro->post['wptouch_restore_settings'])) {
require_once 'admin-backup-restore.php';
wptouch_restore_settings($wptouch_pro->post['wptouch_restore_settings']);
return;
}
$new_settings = array();
$modified_domains = array();
// Search for all the settings to update
foreach ($wptouch_pro->post as $key => $content) {
if (preg_match('#^wptouch__(.*)__(.*)#', $key, $match)) {
$setting_domain = $match[1];
$setting_name = $match[2];
// Decode slashes on strings
if (is_string($content)) {
$content = htmlspecialchars_decode($content);
}
$new_settings[$setting_domain][$setting_name] = apply_filters('wptouch_modify_setting__' . $setting_domain . '__' . $setting_name, $content);
// Flag which domains have been modified
$modified_domains[$setting_domain] = 1;
if (isset($wptouch_pro->post['hid-wptouch__' . $match[1] . '__' . $match[2]])) {
// This is a checkbox
$new_settings[$setting_domain][$setting_name] = 1;
}
}
}
// Do a loop and find all the checkboxes that should be disabled
foreach ($wptouch_pro->post as $key => $content) {
if (preg_match('#^hid-wptouch__(.*)__(.*)#', $key, $match)) {
$setting_domain = $match[1];
$setting_name = $match[2];
$new_settings[$setting_domain][$setting_name] = isset($new_settings[$setting_domain][$setting_name]) ? 1 : 0;
$modified_domains[$setting_domain] = 1;
}
}
// Update all the domains that have been modified
foreach ($modified_domains as $domain => $ignored_value) {
$settings = $wptouch_pro->get_settings($domain);
// Update settings with new values
foreach ($new_settings[$domain] as $key => $value) {
if (isset($settings->{$key})) {
$settings->{$key} = $value;
}
}
$settings->save();
}
// Handle automatic backup
$settings = wptouch_get_settings();
if ($settings->automatically_backup_settings) {
require_once 'admin-backup-restore.php';
wptouch_backup_settings();
}
wptouch_delete_all_transients();
}
}
}
示例11: get_license_reset_info
function get_license_reset_info($product_name)
{
if ($this->internal_check_token()) {
$params = array();
$params['bncid'] = $this->bncid;
$params['product_name'] = $product_name;
WPTOUCH_DEBUG(WPTOUCH_INFO, "Getting license reset information");
$result = $this->do_api_request('user', 'get_license_reset_info', $params, true);
if ($result) {
if ($result['status'] == 'ok') {
return $result['result'];
}
}
}
return false;
}
示例12: wptouch_pro_check_for_update
function wptouch_pro_check_for_update()
{
global $wptouch_pro;
$upgrade_available = WPTOUCH_VERSION;
$wptouch_pro->setup_bncapi();
$bnc_api = $wptouch_pro->get_bnc_api();
$plugin_name = WPTOUCH_ROOT_NAME . '/wptouch-pro.php';
WPTOUCH_DEBUG(WPTOUCH_INFO, 'Checking BNC server for a new product update');
// Check for WordPress 3.0 function
if (function_exists('is_super_admin')) {
$option = get_site_transient('update_plugins');
} else {
$option = function_exists('get_transient') ? get_transient('update_plugins') : get_option('update_plugins');
}
$version_available = false;
if (false === ($latest_info = get_site_transient('_wptouch_bncid_latest_version'))) {
$latest_info = $bnc_api->get_product_version();
set_site_transient('_wptouch_bncid_latest_version', $latest_info, WPTOUCH_API_GENERAL_CACHE_TIME);
}
if ($latest_info && $latest_info['version'] != WPTOUCH_VERSION) {
WPTOUCH_DEBUG(WPTOUCH_INFO, 'A new product update is available [' . $latest_info['version'] . ']');
if (isset($latest_info['upgrade_url']) && wptouch_has_license()) {
if (!isset($option->response[$plugin_name])) {
$option->response[$plugin_name] = new stdClass();
}
// Update upgrade options
$option->response[$plugin_name]->url = 'http://www.wptouch.com/';
$option->response[$plugin_name]->package = $latest_info['upgrade_url'];
$option->response[$plugin_name]->new_version = $latest_info['version'];
$option->response[$plugin_name]->id = '0';
$option->response[$plugin_name]->slug = WPTOUCH_ROOT_NAME;
} else {
if (is_object($option) && isset($option->response)) {
unset($option->response[$plugin_name]);
}
}
$wptouch_pro->latest_version_info = $latest_info;
$upgrade_available = $latest_info['version'];
} else {
if (is_object($option) && isset($option->response)) {
unset($option->response[$plugin_name]);
}
}
// WordPress 3.0 changed some stuff, so we check for a WP 3.0 function
if (function_exists('is_super_admin')) {
set_site_transient('update_plugins', $option);
} else {
if (function_exists('set_transient')) {
set_transient('update_plugins', $option);
}
}
return $upgrade_available;
}
示例13: wptouch_plugins_disable
function wptouch_plugins_disable($wptouch_pro, $settings)
{
foreach ($settings->plugin_hooks as $name => $hook_info) {
if ($name == 'ignore') {
continue;
}
if (isset($settings->enabled_plugins[$name]) && !$settings->enabled_plugins[$name]) {
if (isset($hook_info->filters) && count($hook_info->filters)) {
foreach ($hook_info->filters as $hooks) {
WPTOUCH_DEBUG(WPTOUCH_VERBOSE, "Disable filter [" . $hooks->hook . "] with function [" . $hooks->hook_function . "]");
if ($hooks->priority) {
remove_filter($hooks->hook, $hooks->hook_function, $hooks->priority);
} else {
remove_filter($hooks->hook, $hooks->hook_function);
}
}
}
if (isset($hook_info->actions) && count($hook_info->actions)) {
foreach ($hook_info->actions as $hooks) {
WPTOUCH_DEBUG(WPTOUCH_VERBOSE, "Disable action [" . $hooks->hook . "] with function [" . $hooks->hook_function . "]");
if ($hooks->priority) {
remove_action($hooks->hook, $hooks->hook_function, $hooks->priority);
} else {
remove_action($hooks->hook, $hooks->hook_function);
}
}
}
}
}
}
示例14: recursive_delete
function recursive_delete($source_dir)
{
// Only allow a delete to occur for directories in the main WPtouch data directory
if (strpos($source_dir, '..') !== false || strpos($source_dir, WPTOUCH_BASE_CONTENT_DIR) === false) {
WPTOUCH_DEBUG(WPTOUCH_SECURITY, 'Not deleting directory ' . $source_dir . ' due to possibly security risk');
return;
}
$src_dir = @opendir($source_dir);
if ($src_dir) {
while (($f = readdir($src_dir)) !== false) {
if ($f == '.' || $f == '..') {
continue;
}
$cur_file = $source_dir . '/' . $f;
if (is_dir($cur_file)) {
$this->recursive_delete($cur_file);
@rmdir($cur_file);
} else {
@unlink($cur_file);
}
}
closedir($src_dir);
@rmdir($src_dir);
}
}