当前位置: 首页>>代码示例>>PHP>>正文


PHP uninstall_plugin函数代码示例

本文整理汇总了PHP中uninstall_plugin函数的典型用法代码示例。如果您正苦于以下问题:PHP uninstall_plugin函数的具体用法?PHP uninstall_plugin怎么用?PHP uninstall_plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了uninstall_plugin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute()
 {
     global $CFG;
     require_once $CFG->libdir . '/adminlib.php';
     // various admin-only functions
     require_once $CFG->libdir . '/upgradelib.php';
     // general upgrade/install related functions
     require_once $CFG->libdir . '/environmentlib.php';
     require_once $CFG->libdir . '/pluginlib.php';
     require_once $CFG->dirroot . '/course/lib.php';
     //some variables you may want to use
     //$this->cwd - the directory where moosh command was executed
     //$this->mooshDir - moosh installation directory
     //$this->expandedOptions - commandline provided options, merged with defaults
     //$this->topDir - top Moodle directory
     //$this->arguments[0] - first argument passed
     //$options = $this->expandedOptions;
     $split = explode('_', $this->arguments[0], 2);
     uninstall_plugin($split[0], $split[1]);
     upgrade_noncore(true);
     /* if verbose mode was requested, show some more information/debug messages
        if($this->verbose) {
            echo "Say what you're doing now";
        }
        */
 }
开发者ID:dariogs,项目名称:moosh,代码行数:26,代码来源:ModuleReinstall.php

示例2: uninstall

 /**
  * Uninstall a plugin
  *
  * @param array $args
  */
 function uninstall($args)
 {
     list($file, $name) = $this->parse_name($args, __FUNCTION__);
     if (is_plugin_active($file)) {
         WP_CLI::error('The plugin is active.');
     }
     uninstall_plugin($file);
 }
开发者ID:bytewang,项目名称:wp-cli,代码行数:13,代码来源:plugin.php

示例3: uninstall_plugin

/**
 * Automatically clean-up all plugin data and remove the plugin DB tables
 *
 * @param string $type The plugin type, eg. 'mod', 'qtype', 'workshopgrading' etc.
 * @param string $name The plugin name, eg. 'forum', 'multichoice', 'accumulative' etc.
 * @uses global $OUTPUT to produce notices and other messages
 * @return void
 */
function uninstall_plugin($type, $name)
{
    global $CFG, $DB, $OUTPUT;
    // recursively uninstall all module subplugins first
    if ($type === 'mod') {
        if (file_exists("{$CFG->dirroot}/mod/{$name}/db/subplugins.php")) {
            $subplugins = array();
            include "{$CFG->dirroot}/mod/{$name}/db/subplugins.php";
            foreach ($subplugins as $subplugintype => $dir) {
                $instances = get_plugin_list($subplugintype);
                foreach ($instances as $subpluginname => $notusedpluginpath) {
                    uninstall_plugin($subplugintype, $subpluginname);
                }
            }
        }
    }
    $component = $type . '_' . $name;
    // eg. 'qtype_multichoice' or 'workshopgrading_accumulative' or 'mod_forum'
    if ($type === 'mod') {
        $pluginname = $name;
        // eg. 'forum'
        if (get_string_manager()->string_exists('modulename', $component)) {
            $strpluginname = get_string('modulename', $component);
        } else {
            $strpluginname = $component;
        }
    } else {
        $pluginname = $component;
        if (get_string_manager()->string_exists('pluginname', $component)) {
            $strpluginname = get_string('pluginname', $component);
        } else {
            $strpluginname = $component;
        }
    }
    echo $OUTPUT->heading($pluginname);
    $plugindirectory = get_plugin_directory($type, $name);
    $uninstalllib = $plugindirectory . '/db/uninstall.php';
    if (file_exists($uninstalllib)) {
        require_once $uninstalllib;
        $uninstallfunction = 'xmldb_' . $pluginname . '_uninstall';
        // eg. 'xmldb_workshop_uninstall()'
        if (function_exists($uninstallfunction)) {
            if (!$uninstallfunction()) {
                echo $OUTPUT->notification('Encountered a problem running uninstall function for ' . $pluginname);
            }
        }
    }
    if ($type === 'mod') {
        // perform cleanup tasks specific for activity modules
        if (!($module = $DB->get_record('modules', array('name' => $name)))) {
            print_error('moduledoesnotexist', 'error');
        }
        // delete all the relevant instances from all course sections
        if ($coursemods = $DB->get_records('course_modules', array('module' => $module->id))) {
            foreach ($coursemods as $coursemod) {
                if (!delete_mod_from_section($coursemod->id, $coursemod->section)) {
                    echo $OUTPUT->notification("Could not delete the {$strpluginname} with id = {$coursemod->id} from section {$coursemod->section}");
                }
            }
        }
        // clear course.modinfo for courses that used this module
        $sql = "UPDATE {course}\n                   SET modinfo=''\n                 WHERE id IN (SELECT DISTINCT course\n                                FROM {course_modules}\n                               WHERE module=?)";
        $DB->execute($sql, array($module->id));
        // delete all the course module records
        $DB->delete_records('course_modules', array('module' => $module->id));
        // delete module contexts
        if ($coursemods) {
            foreach ($coursemods as $coursemod) {
                if (!delete_context(CONTEXT_MODULE, $coursemod->id)) {
                    echo $OUTPUT->notification("Could not delete the context for {$strpluginname} with id = {$coursemod->id}");
                }
            }
        }
        // delete the module entry itself
        $DB->delete_records('modules', array('name' => $module->name));
        // cleanup the gradebook
        require_once $CFG->libdir . '/gradelib.php';
        grade_uninstalled_module($module->name);
        // Perform any custom uninstall tasks
        if (file_exists($CFG->dirroot . '/mod/' . $module->name . '/lib.php')) {
            require_once $CFG->dirroot . '/mod/' . $module->name . '/lib.php';
            $uninstallfunction = $module->name . '_uninstall';
            if (function_exists($uninstallfunction)) {
                debugging("{$uninstallfunction}() has been deprecated. Use the plugin's db/uninstall.php instead", DEBUG_DEVELOPER);
                if (!$uninstallfunction()) {
                    echo $OUTPUT->notification('Encountered a problem running uninstall function for ' . $module->name . '!');
                }
            }
        }
    } else {
        if ($type === 'enrol') {
            // NOTE: this is a bit brute force way - it will not trigger events and hooks properly
//.........这里部分代码省略.........
开发者ID:raymondAntonio,项目名称:moodle,代码行数:101,代码来源:adminlib.php

示例4: print_error

    echo $OUTPUT->header();
    echo $OUTPUT->heading($strmanageblocks);
    if (!($block = blocks_get_record($delete))) {
        print_error('blockdoesnotexist', 'error');
    }
    if (get_string_manager()->string_exists('pluginname', "block_{$block->name}")) {
        $strblockname = get_string('pluginname', "block_{$block->name}");
    } else {
        $strblockname = $block->name;
    }
    if (!$confirm) {
        echo $OUTPUT->confirm(get_string('blockdeleteconfirm', '', $strblockname), 'blocks.php?delete=' . $block->id . '&confirm=1', 'blocks.php');
        echo $OUTPUT->footer();
        exit;
    } else {
        uninstall_plugin('block', $block->name);
        $a = new stdClass();
        $a->block = $strblockname;
        $a->directory = $CFG->dirroot . '/blocks/' . $block->name;
        notice(get_string('blockdeletefiles', '', $a), 'blocks.php');
    }
}
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
/// Main display starts here
/// Get and sort the existing blocks
if (!($blocks = $DB->get_records('block', array(), 'name ASC'))) {
    print_error('noblocks', 'error');
    // Should never happen
}
$incompatible = array();
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:blocks.php

示例5: trim

     break;
 case 'install':
     $plugin_name = trim(gpc('plugin_name', 'G', ''));
     if ($plugin_name) {
         include_once PD_PLUGINS_DIR . "{$plugin_name}/install.inc.php";
         install_plugin();
         write_file(PD_PLUGINS_DIR . "{$plugin_name}/install.lock", "PHPDISK {$plugin_name} plugin installed!");
     }
     $sysmsg[] = __('plugin_install_success');
     redirect($_SERVER['HTTP_REFERER'], $sysmsg);
     break;
 case 'uninstall':
     $plugin_name = trim(gpc('plugin_name', 'G', ''));
     if ($plugin_name) {
         include_once PD_PLUGINS_DIR . "{$plugin_name}/install.inc.php";
         uninstall_plugin();
         @unlink(PD_PLUGINS_DIR . "{$plugin_name}/install.lock");
         $ins = array('plugin_name' => $plugin_name, 'active' => 0);
         $sqls = "('{$ins[plugin_name]}','{$ins[active]}')";
         $db->query("replace into {$tpf}plugins(plugin_name,actived) values {$sqls} ;");
     }
     $sysmsg[] = __('plugin_uninstall_success');
     redirect($_SERVER['HTTP_REFERER'], $sysmsg);
     break;
 case 'actived_plugins':
     $sql_do = " where actived=1";
     $perpage = 10;
     $rs = $db->fetch_one_array("select count(*) as total_num from {$tpf}plugins {$sql_do}");
     $total_num = $rs['total_num'];
     $start_num = ($pg - 1) * $perpage;
     $q = $db->query("select * from {$tpf}plugins {$sql_do} order by plugin_name asc limit {$start_num},{$perpage}");
开发者ID:saintho,项目名称:phpdisk,代码行数:31,代码来源:plugins.inc.php

示例6: delete_plugins

/**
 * Remove directory and files of a plugin for a list of plugins.
 *
 * @since 2.6.0
 *
 * @global WP_Filesystem_Base $wp_filesystem
 *
 * @param array  $plugins    List of plugins to delete.
 * @param string $deprecated Deprecated.
 * @return bool|null|WP_Error True on success, false is $plugins is empty, WP_Error on failure.
 *                            Null if filesystem credentials are required to proceed.
 */
function delete_plugins( $plugins, $deprecated = '' ) {
	global $wp_filesystem;

	if ( empty($plugins) )
		return false;

	$checked = array();
	foreach( $plugins as $plugin )
		$checked[] = 'checked[]=' . $plugin;

	ob_start();
	$url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins');
	if ( false === ($credentials = request_filesystem_credentials($url)) ) {
		$data = ob_get_contents();
		ob_end_clean();
		if ( ! empty($data) ){
			include_once( ABSPATH . 'wp-admin/admin-header.php');
			echo $data;
			include( ABSPATH . 'wp-admin/admin-footer.php');
			exit;
		}
		return;
	}

	if ( ! WP_Filesystem($credentials) ) {
		request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
		$data = ob_get_contents();
		ob_end_clean();
		if ( ! empty($data) ){
			include_once( ABSPATH . 'wp-admin/admin-header.php');
			echo $data;
			include( ABSPATH . 'wp-admin/admin-footer.php');
			exit;
		}
		return;
	}

	if ( ! is_object($wp_filesystem) )
		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));

	if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
		return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors);

	// Get the base plugin folder.
	$plugins_dir = $wp_filesystem->wp_plugins_dir();
	if ( empty( $plugins_dir ) ) {
		return new WP_Error( 'fs_no_plugins_dir', __( 'Unable to locate WordPress Plugin directory.' ) );
	}

	$plugins_dir = trailingslashit( $plugins_dir );

	$plugin_translations = wp_get_installed_translations( 'plugins' );

	$errors = array();

	foreach( $plugins as $plugin_file ) {
		// Run Uninstall hook.
		if ( is_uninstallable_plugin( $plugin_file ) ) {
			uninstall_plugin($plugin_file);
		}

		$this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) );
		// If plugin is in its own directory, recursively delete the directory.
		if ( strpos( $plugin_file, '/' ) && $this_plugin_dir != $plugins_dir ) { //base check on if plugin includes directory separator AND that it's not the root plugin folder
			$deleted = $wp_filesystem->delete( $this_plugin_dir, true );
		} else {
			$deleted = $wp_filesystem->delete( $plugins_dir . $plugin_file );
		}

		if ( ! $deleted ) {
			$errors[] = $plugin_file;
			continue;
		}

		// Remove language files, silently.
		$plugin_slug = dirname( $plugin_file );
		if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) {
			$translations = $plugin_translations[ $plugin_slug ];

			foreach ( $translations as $translation => $data ) {
				$wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.po' );
				$wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.mo' );
			}
		}
	}

	// Remove deleted plugins from the plugin updates list.
	if ( $current = get_site_transient('update_plugins') ) {
//.........这里部分代码省略.........
开发者ID:ShankarVellal,项目名称:WordPress,代码行数:101,代码来源:plugin.php

示例7: uninstall

 /**
  * Uninstall a plugin.
  *
  * ## OPTIONS
  *
  * <plugin>...
  * : One or more plugins to uninstall.
  *
  * [--deactivate]
  * : Deactivate the plugin before uninstalling. Default behavior is to warn and skip if the plugin is active.
  *
  * [--skip-delete]
  * : If set, the plugin files will not be deleted. Only the uninstall procedure
  * will be run.
  *
  * ## EXAMPLES
  *
  *     wp plugin uninstall hello
  */
 function uninstall($args, $assoc_args = array())
 {
     foreach ($this->fetcher->get_many($args) as $plugin) {
         if (is_plugin_active($plugin->file) && !WP_CLI\Utils\get_flag_value($assoc_args, 'deactivate')) {
             WP_CLI::warning("The '{$plugin->name}' plugin is active.");
             continue;
         }
         if (\WP_CLI\Utils\get_flag_value($assoc_args, 'deactivate')) {
             WP_CLI::log("Deactivating '{$plugin->name}'...");
             $this->deactivate(array($plugin->name));
         }
         uninstall_plugin($plugin->file);
         if (!\WP_CLI\Utils\get_flag_value($assoc_args, 'skip-delete') && $this->_delete($plugin)) {
             WP_CLI::success("Uninstalled and deleted '{$plugin->name}' plugin.");
         } else {
             WP_CLI::success("Ran uninstall procedure for '{$plugin->name}' plugin without deleting.");
         }
     }
 }
开发者ID:kyeates,项目名称:wp-cli,代码行数:38,代码来源:plugin.php

示例8: admin_page_plugins

 /**
  * Plugins admin page
  *
  * @param App $a
  * @return string
  */
 function admin_page_plugins(&$a)
 {
     /*
      * Single plugin
      */
     if (\App::$argc == 3) {
         $plugin = \App::$argv[2];
         if (!is_file("addon/{$plugin}/{$plugin}.php")) {
             notice(t("Item not found."));
             return '';
         }
         $enabled = in_array($plugin, \App::$plugins);
         $info = get_plugin_info($plugin);
         $x = check_plugin_versions($info);
         // disable plugins which are installed but incompatible versions
         if ($enabled && !$x) {
             $enabled = false;
             $idz = array_search($plugin, \App::$plugins);
             if ($idz !== false) {
                 unset(\App::$plugins[$idz]);
                 uninstall_plugin($plugin);
                 set_config("system", "addon", implode(", ", \App::$plugins));
             }
         }
         $info['disabled'] = 1 - intval($x);
         if (x($_GET, "a") && $_GET['a'] == "t") {
             check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't');
             // Toggle plugin status
             $idx = array_search($plugin, \App::$plugins);
             if ($idx !== false) {
                 unset(\App::$plugins[$idx]);
                 uninstall_plugin($plugin);
                 info(sprintf(t("Plugin %s disabled."), $plugin));
             } else {
                 \App::$plugins[] = $plugin;
                 install_plugin($plugin);
                 info(sprintf(t("Plugin %s enabled."), $plugin));
             }
             set_config("system", "addon", implode(", ", \App::$plugins));
             goaway(z_root() . '/admin/plugins');
         }
         // display plugin details
         require_once 'library/markdown.php';
         if (in_array($plugin, \App::$plugins)) {
             $status = 'on';
             $action = t('Disable');
         } else {
             $status = 'off';
             $action = t('Enable');
         }
         $readme = null;
         if (is_file("addon/{$plugin}/README.md")) {
             $readme = file_get_contents("addon/{$plugin}/README.md");
             $readme = Markdown($readme);
         } else {
             if (is_file("addon/{$plugin}/README")) {
                 $readme = "<pre>" . file_get_contents("addon/{$plugin}/README") . "</pre>";
             }
         }
         $admin_form = '';
         $r = q("select * from addon where plugin_admin = 1 and name = '%s' limit 1", dbesc($plugin));
         if ($r) {
             @(require_once "addon/{$plugin}/{$plugin}.php");
             if (function_exists($plugin . '_plugin_admin')) {
                 $func = $plugin . '_plugin_admin';
                 $func($a, $admin_form);
             }
         }
         $t = get_markup_template('admin_plugins_details.tpl');
         return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), '$baseurl' => z_root(), '$plugin' => $plugin, '$status' => $status, '$action' => $action, '$info' => $info, '$str_author' => t('Author: '), '$str_maintainer' => t('Maintainer: '), '$str_minversion' => t('Minimum project version: '), '$str_maxversion' => t('Maximum project version: '), '$str_minphpversion' => t('Minimum PHP version: '), '$str_requires' => t('Requires: '), '$disabled' => t('Disabled - version incompatibility'), '$admin_form' => $admin_form, '$function' => 'plugins', '$screenshot' => '', '$readme' => $readme, '$form_security_token' => get_form_security_token('admin_plugins')));
     }
     /*
      * List plugins
      */
     $plugins = array();
     $files = glob('addon/*/');
     if ($files) {
         foreach ($files as $file) {
             if (is_dir($file)) {
                 list($tmp, $id) = array_map('trim', explode('/', $file));
                 $info = get_plugin_info($id);
                 $enabled = in_array($id, \App::$plugins);
                 $x = check_plugin_versions($info);
                 // disable plugins which are installed but incompatible versions
                 if ($enabled && !$x) {
                     $enabled = false;
                     $idz = array_search($id, \App::$plugins);
                     if ($idz !== false) {
                         unset(\App::$plugins[$idz]);
                         uninstall_plugin($id);
                         set_config("system", "addon", implode(", ", \App::$plugins));
                     }
                 }
                 $info['disabled'] = 1 - intval($x);
//.........这里部分代码省略.........
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:101,代码来源:Admin.php

示例9: uninstall

 /**
  * Run the plugin's uninstall script.
  *
  * Call it and then run your uninstall assertions. You should always test
  * installation before testing uninstallation.
  *
  * @since 0.1.0
  */
 public function uninstall()
 {
     global $wpdb;
     if (!$this->simulated_usage) {
         $wpdb->query('ROLLBACK');
         // If the plugin has a usage simulation file, run it remotely.
         $this->simulate_usage();
     }
     // We're going to do real table dropping, not temporary tables.
     $drop_temp_tables = array($this, '_drop_temporary_table');
     // Back compat. See https://core.trac.wordpress.org/ticket/24800.
     if (method_exists($this, '_drop_temporary_tables')) {
         $drop_temp_tables = array($this, '_drop_temporary_tables');
     }
     remove_filter('query', $drop_temp_tables);
     if (empty($this->plugin_file)) {
         $this->fail('Error: $plugin_file property not set.');
     }
     uninstall_plugin($this->plugin_file);
     $this->flush_cache();
 }
开发者ID:jdgrimes,项目名称:wp-plugin-uninstall-tester,代码行数:29,代码来源:wp-plugin-uninstall-unittestcase.php

示例10: array_flip

        }
        $enabled = array_flip($enabled);
        $enabled[$current] = $enabled[$current + 1];
        $enabled[$current + 1] = $enrol;
        set_config('enrol_plugins_enabled', implode(',', $enabled));
        break;
    case 'uninstall':
        echo $OUTPUT->header();
        echo $OUTPUT->heading(get_string('enrolments', 'enrol'));
        if (get_string_manager()->string_exists('pluginname', 'enrol_' . $enrol)) {
            $strplugin = get_string('pluginname', 'enrol_' . $enrol);
        } else {
            $strplugin = $enrol;
        }
        if (!$confirm) {
            $uurl = new moodle_url('/admin/enrol.php', array('action' => 'uninstall', 'enrol' => $enrol, 'sesskey' => sesskey(), 'confirm' => 1));
            echo $OUTPUT->confirm(get_string('uninstallconfirm', 'enrol', $strplugin), $uurl, $return);
            echo $OUTPUT->footer();
            exit;
        } else {
            // Delete everything!!
            uninstall_plugin('enrol', $enrol);
            $a->plugin = $strplugin;
            $a->directory = "{$CFG->dirroot}/enrol/{$enrol}";
            echo $OUTPUT->notification(get_string('uninstalldeletefiles', 'enrol', $a), 'notifysuccess');
            echo $OUTPUT->continue_button($return);
            echo $OUTPUT->footer();
            exit;
        }
}
redirect($return);
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:enrol.php

示例11: optional_param

$confirm = optional_param('confirm', false, PARAM_BOOL);
if (!empty($delete) and confirm_sesskey()) {
    // If data submitted, then process and store.
    echo $OUTPUT->header();
    echo $OUTPUT->heading(get_string('manageplagiarism', 'plagiarism'));
    if (!$confirm) {
        if (get_string_manager()->string_exists('pluginname', 'plagiarism_' . $delete)) {
            $strpluginname = get_string('pluginname', 'plagiarism_' . $delete);
        } else {
            $strpluginname = $delete;
        }
        echo $OUTPUT->confirm(get_string('plagiarismplugindeleteconfirm', 'plagiarism', $strpluginname), new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)), $PAGE->url);
        echo $OUTPUT->footer();
        die;
    } else {
        uninstall_plugin('plagiarism', $delete);
        $a = new stdclass();
        $a->name = $delete;
        $pluginlocation = get_plugin_types();
        $a->directory = $pluginlocation['plagiarism'] . '/' . $delete;
        echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
        echo $OUTPUT->continue_button($PAGE->url);
        echo $OUTPUT->footer();
        die;
    }
}
echo $OUTPUT->header();
// Print the table of all installed plagiarism plugins.
$txt = get_strings(array('settings', 'name', 'version', 'delete'));
$plagiarismplugins = get_plugin_list('plagiarism');
if (empty($plagiarismplugins)) {
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:plagiarism.php

示例12: uninstall

 /**
  * Uninstall a plugin.
  *
  * ## OPTIONS
  *
  * <plugin>...
  * : One or more plugins to uninstall.
  *
  * [--skip-delete]
  * : If set, the plugin files will not be deleted. Only the uninstall procedure
  * will be run.
  *
  * ## EXAMPLES
  *
  *     wp plugin uninstall hello
  */
 function uninstall($args, $assoc_args = array())
 {
     foreach ($this->fetcher->get_many($args) as $plugin) {
         if (is_plugin_active($plugin->file)) {
             WP_CLI::warning("The '{$plugin->name}' plugin is active.");
             continue;
         }
         uninstall_plugin($plugin->file);
         if (!isset($assoc_args['skip-delete']) && $this->_delete($plugin)) {
             WP_CLI::success("Uninstalled and deleted '{$plugin->name}' plugin.");
         } else {
             WP_CLI::success("Ran uninstall procedure for '{$plugin->name}' plugin without deleting.");
         }
     }
 }
开发者ID:adeagboola,项目名称:wordpress-to-jekyll-exporter,代码行数:31,代码来源:plugin.php

示例13: optional_param

$confirm = optional_param('confirm', '', PARAM_BOOL);
/// If data submitted, then process and store.
if (!empty($delete) and confirm_sesskey()) {
    echo $OUTPUT->header();
    echo $OUTPUT->heading(get_string('tools', 'admin'));
    if (!$confirm) {
        if (get_string_manager()->string_exists('pluginname', 'tool_' . $delete)) {
            $strpluginname = get_string('pluginname', 'tool_' . $delete);
        } else {
            $strpluginname = $delete;
        }
        echo $OUTPUT->confirm(get_string('toolsdeleteconfirm', 'admin', $strpluginname), new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)), $PAGE->url);
        echo $OUTPUT->footer();
        die;
    } else {
        uninstall_plugin('tool', $delete);
        $a = new stdclass();
        $a->name = $delete;
        $pluginlocation = get_plugin_types();
        $a->directory = $pluginlocation['tool'] . '/' . $delete;
        echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
        echo $OUTPUT->continue_button($PAGE->url);
        echo $OUTPUT->footer();
        die;
    }
}
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('tools', 'admin'));
/// Print the table of all installed tool plugins
$table = new flexible_table('toolplugins_administration_table');
$table->define_columns(array('name', 'version', 'delete'));
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:tools.php

示例14: uninstall

 /**
  * Uninstall a plugin.
  *
  * @synopsis <plugin> [--no-delete]
  */
 function uninstall($args, $assoc_args = array())
 {
     list($file, $name) = $this->parse_name($args);
     if (is_plugin_active($file)) {
         WP_CLI::error('The plugin is active.');
     }
     uninstall_plugin($file);
     if (!isset($assoc_args['no-delete'])) {
         $this->delete($args);
     }
 }
开发者ID:nunomorgadinho,项目名称:wp-cli,代码行数:16,代码来源:plugin.php

示例15: admin_page_plugins

/**
 * Plugins admin page
 *
 * @param App $a
 * @return string
 */
function admin_page_plugins(&$a)
{
    /*
     * Single plugin
     */
    if ($a->argc == 3) {
        $plugin = $a->argv[2];
        if (!is_file("addon/{$plugin}/{$plugin}.php")) {
            notice(t("Item not found."));
            return '';
        }
        if (x($_GET, "a") && $_GET['a'] == "t") {
            check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't');
            // Toggle plugin status
            $idx = array_search($plugin, $a->plugins);
            if ($idx !== false) {
                unset($a->plugins[$idx]);
                uninstall_plugin($plugin);
                info(sprintf(t("Plugin %s disabled."), $plugin));
            } else {
                $a->plugins[] = $plugin;
                install_plugin($plugin);
                info(sprintf(t("Plugin %s enabled."), $plugin));
            }
            set_config("system", "addon", implode(", ", $a->plugins));
            goaway($a->get_baseurl(true) . '/admin/plugins');
        }
        // display plugin details
        require_once 'library/markdown.php';
        if (in_array($plugin, $a->plugins)) {
            $status = 'on';
            $action = t('Disable');
        } else {
            $status = 'off';
            $action = t('Enable');
        }
        $readme = null;
        if (is_file("addon/{$plugin}/README.md")) {
            $readme = file_get_contents("addon/{$plugin}/README.md");
            $readme = Markdown($readme);
        } else {
            if (is_file("addon/{$plugin}/README")) {
                $readme = "<pre>" . file_get_contents("addon/{$plugin}/README") . "</pre>";
            }
        }
        $admin_form = '';
        if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)) {
            @(require_once "addon/{$plugin}/{$plugin}.php");
            if (function_exists($plugin . '_plugin_admin')) {
                $func = $plugin . '_plugin_admin';
                $func($a, $admin_form);
            }
        }
        $t = get_markup_template('admin_plugins_details.tpl');
        return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), '$baseurl' => $a->get_baseurl(true), '$plugin' => $plugin, '$status' => $status, '$action' => $action, '$info' => get_plugin_info($plugin), '$str_author' => t('Author: '), '$str_maintainer' => t('Maintainer: '), '$admin_form' => $admin_form, '$function' => 'plugins', '$screenshot' => '', '$readme' => $readme, '$form_security_token' => get_form_security_token('admin_plugins')));
    }
    /*
     * List plugins
     */
    $plugins = array();
    $files = glob('addon/*/');
    if ($files) {
        foreach ($files as $file) {
            if (is_dir($file)) {
                list($tmp, $id) = array_map('trim', explode('/', $file));
                $info = get_plugin_info($id);
                $plugins[] = array($id, in_array($id, $a->plugins) ? "on" : "off", $info);
            }
        }
    }
    $t = get_markup_template('admin_plugins.tpl');
    return replace_macros($t, array('$title' => t('Administration'), '$page' => t('Plugins'), '$submit' => t('Submit'), '$baseurl' => $a->get_baseurl(true), '$function' => 'plugins', '$plugins' => $plugins, '$form_security_token' => get_form_security_token('admin_plugins')));
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:79,代码来源:admin.php


注:本文中的uninstall_plugin函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。