本文整理汇总了PHP中wp_register_plugin_realpath函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_register_plugin_realpath函数的具体用法?PHP wp_register_plugin_realpath怎么用?PHP wp_register_plugin_realpath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_register_plugin_realpath函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: loadPlugins
/**
* Load up the mu-plugin packages!
*/
function loadPlugins()
{
// do we have packages? maybe no if json/file error
if (!empty($this->packageData['packages'])) {
// get the mu-plugins path relative to plugins so that plugins_url functions work properly
$muPath = $this->muPluginsRelPath();
foreach ($this->packageData['packages'] as $pluginFile) {
if (file_exists($realPath = __DIR__ . '/' . $pluginFile)) {
$this->plugins[] = $realPath;
// in case this directory is symlinked, inform WP about the symlink vs. real path
wp_register_plugin_realpath("{$muPath}/{$pluginFile}");
include_once $realPath;
}
}
}
$this->pluginHooks();
}
开发者ID:balbuf,项目名称:composer-wp,代码行数:20,代码来源:composer-wp-autoloader.php
示例2: wp_redirect
if (!isset($_GET['failure']) && !isset($_GET['success'])) {
wp_redirect(admin_url('update.php?action=activate-plugin&failure=true&plugin=' . urlencode($plugin) . '&_wpnonce=' . $_GET['_wpnonce']));
activate_plugin($plugin, '', !empty($_GET['networkwide']), true);
wp_redirect(admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode($plugin) . '&_wpnonce=' . $_GET['_wpnonce']));
die;
}
iframe_header(__('Plugin Reactivation'), true);
if (isset($_GET['success'])) {
echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
}
if (isset($_GET['failure'])) {
echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
@ini_set('display_errors', true);
//Ensure that Fatal errors are displayed.
wp_register_plugin_realpath(WP_PLUGIN_DIR . '/' . $plugin);
include WP_PLUGIN_DIR . '/' . $plugin;
}
iframe_footer();
} elseif ('install-plugin' == $action) {
if (!current_user_can('install_plugins')) {
wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
}
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
//for plugins_api..
check_admin_referer('install-plugin_' . $plugin);
$api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false)));
//Save on a bit of bandwidth.
if (is_wp_error($api)) {
wp_die($api);
}
开发者ID:ajspencer,项目名称:NCSSM-SG-WordPress,代码行数:31,代码来源:update.php
示例3: plugin_sandbox_scrape
/**
* @param string $plugin
*/
function plugin_sandbox_scrape($plugin)
{
wp_register_plugin_realpath(WP_PLUGIN_DIR . '/' . $plugin);
include WP_PLUGIN_DIR . '/' . $plugin;
}
开发者ID:Plego,项目名称:toyoa,代码行数:8,代码来源:plugins.php
示例4: uninstall_plugin
/**
* Uninstall a single plugin.
*
* Calls the uninstall hook, if it is available.
*
* @since 2.7.0
*
* @param string $plugin Relative plugin path from Plugin Directory.
* @return true True if a plugin's uninstall.php file has been found and included.
*/
function uninstall_plugin($plugin) {
$file = plugin_basename($plugin);
$uninstallable_plugins = (array) get_option('uninstall_plugins');
if ( file_exists( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' ) ) {
if ( isset( $uninstallable_plugins[$file] ) ) {
unset($uninstallable_plugins[$file]);
update_option('uninstall_plugins', $uninstallable_plugins);
}
unset($uninstallable_plugins);
define('WP_UNINSTALL_PLUGIN', $file);
wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . dirname( $file ) );
include( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' );
return true;
}
if ( isset( $uninstallable_plugins[$file] ) ) {
$callable = $uninstallable_plugins[$file];
unset($uninstallable_plugins[$file]);
update_option('uninstall_plugins', $uninstallable_plugins);
unset($uninstallable_plugins);
wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file );
include( WP_PLUGIN_DIR . '/' . $file );
add_action( 'uninstall_' . $file, $callable );
/**
* Fires in uninstall_plugin() once the plugin has been uninstalled.
*
* The action concatenates the 'uninstall_' prefix with the basename of the
* plugin passed to {@see uninstall_plugin()} to create a dynamically-named action.
*
* @since 2.7.0
*/
do_action( 'uninstall_' . $file );
}
}
开发者ID:ShankarVellal,项目名称:WordPress,代码行数:50,代码来源:plugin.php
示例5: wp_cookie_constants
}
// Define constants after multisite is loaded.
wp_cookie_constants();
// Define and enforce our SSL constants
wp_ssl_constants();
// Create common globals.
require ABSPATH . WPINC . '/vars.php';
// Make taxonomies and posts available to plugins and themes.
// @plugin authors: warning: these get registered again on the init hook.
create_initial_taxonomies();
create_initial_post_types();
// Register the default theme directory root
register_theme_directory(get_theme_root());
// Load active plugins.
foreach (wp_get_active_and_valid_plugins() as $plugin) {
wp_register_plugin_realpath($plugin);
include_once $plugin;
}
unset($plugin);
// Load pluggable functions.
require ABSPATH . WPINC . '/pluggable.php';
require ABSPATH . WPINC . '/pluggable-deprecated.php';
// Set internal encoding.
wp_set_internal_encoding();
// Run wp_cache_postload() if object cache is enabled and the function exists.
if (WP_CACHE && function_exists('wp_cache_postload')) {
wp_cache_postload();
}
/**
* Fires once activated plugins have loaded.
*
开发者ID:bekkenj,项目名称:WordPress,代码行数:31,代码来源:wp-settings.php
示例6: loadPlugin
/**
* Check and load a discovered file. Handle problems if file is invalid or unreadable.
*
* @param string $key
* @param string $file
* @param bool $refresh
* @param string $transient
* @return bool
*/
private function loadPlugin($key, $file, $refresh, $transient)
{
if (is_readable($file) && strtolower(pathinfo($file, PATHINFO_EXTENSION)) === 'php') {
wp_register_plugin_realpath($file);
if (in_array($file, $this->regular, true)) {
$this->regularLoaded[] = $file;
}
include_once $file;
$this->loaded[] = $file;
return true;
}
if ($refresh) {
// remove non-readable or non-php files from array of files to be saved
unset($this->plugins[$key]);
return true;
}
// If here, a non-readable or non-php file is cached: let's delete cache and restart
delete_site_transient(self::PREFIX . $transient);
delete_site_transient(self::PREFIX . self::TRANSIENT);
$this->__invoke(true);
return false;
}
开发者ID:GaryJones,项目名称:wpstarter,代码行数:31,代码来源:MuLoader.php
示例7: update_active_plugins
protected function update_active_plugins($plugins, $redirect)
{
if (!$plugins) {
$plugins = array();
}
// make sure including any of the plugins will not generate a fatal error
foreach ($plugins as $plugin) {
wp_redirect(add_query_arg(array('_error_nonce' => wp_create_nonce('plugin-activation-error_' . $plugin), 'error' => true, 'plugin' => $plugin), $redirect));
ob_start();
wp_register_plugin_realpath(WP_PLUGIN_DIR . '/' . $plugin);
include_once WP_PLUGIN_DIR . '/' . $plugin;
ob_get_clean();
}
wp_redirect(admin_url('admin.php?page=gravityformsdebug&action=active-plugins-updated'));
return update_user_meta(get_current_user_id(), $this->prefix('ct_active_plugins'), $plugins);
}
开发者ID:danielbachhuber,项目名称:marcgratch.com,代码行数:16,代码来源:debug.php
注:本文中的wp_register_plugin_realpath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论