本文整理汇总了PHP中MS_Plugin::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Plugin::instance方法的具体用法?PHP MS_Plugin::instance怎么用?PHP MS_Plugin::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Plugin
的用法示例。
在下文中一共展示了MS_Plugin::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_columns
public function get_columns()
{
$currency = MS_Plugin::instance()->settings->currency;
$columns = apply_filters('ms_helper_listtable_billing_columns', array('cb' => '<input type="checkbox" />', 'invoice' => __('Invoice #', 'membership2'), 'user' => __('User', 'membership2'), 'membership' => __('Membership', 'membership2'), 'status' => __('Status', 'membership2'), 'total' => __('Total', 'membership2'), 'due_date' => __('Due date', 'membership2'), 'gateway_id' => __('Gateway', 'membership2')));
$columns = apply_filters('ms_helper_listtable_billing_get_columns', $columns, $currency);
return $columns;
}
示例2: get_columns
/**
* Defines the columns of the list table
*
* @since 1.0.0
* @return array
*/
public function get_columns()
{
$currency = MS_Plugin::instance()->settings->currency;
$columns = apply_filters('ms_helper_listtable_transactionlog_columns', array('id' => __('ID', 'membership2'), 'date' => __('Time', 'membership2'), 'status' => '', 'method' => '', 'gateway' => __('Gateway', 'membership2'), 'amount' => __('Amount', 'membership2'), 'invoice' => __('Invoice', 'membership2'), 'note' => __('Details', 'membership2')));
$columns = apply_filters('ms_helper_listtable_transactionlog_get_columns', $columns, $currency);
return $columns;
}
示例3: prepare_fields
/**
* Prepare html fields.
*
* @since 1.0.0
*
* @return array
*/
function prepare_fields()
{
$invoice = $this->data['invoice'];
$currency = MS_Plugin::instance()->settings->currency;
$user_name = '';
$transaction_link = '';
$user_id = 0;
$user_list = array();
if ($invoice->id) {
$member = $invoice->get_member();
$user_id = $member->id;
$user_name = $member->name;
$transaction_link = sprintf('<a href="%s" target="_blank">%s</a>', MS_Controller_Plugin::get_admin_url('billing', array('show' => 'logs', 'invoice' => $invoice->id)), __('Show Transactions', 'membership2'));
} else {
$user_list = MS_Model_Member::get_usernames(null, MS_Model_Member::SEARCH_ALL_USERS);
}
$fields = array('link_transactions' => array('id' => 'link_transactions', 'title' => $transaction_link, 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'wrapper_class' => 'ms-transactions-link'), 'txt_user' => array('id' => 'txt_user', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => sprintf('<a href="%s">%s</a>', MS_Controller_Plugin::get_admin_url('add-member', array('user_id' => $user_id)), $user_name)), 'txt_membership' => array('id' => 'txt_membership', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_created' => array('id' => 'txt_created', 'title' => __('Invoice created on', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'status' => array('id' => 'status', 'title' => __('Invoice status', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'field_options' => MS_Model_Invoice::get_status_types(true), 'value' => $invoice->status), 'user_id' => array('id' => 'user_id', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->user_id, 'field_options' => $user_list), 'membership_id' => array('id' => 'membership_id', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->membership_id, 'field_options' => $this->data['memberships']), 'amount' => array('id' => 'amount', 'title' => sprintf(__('Amount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->amount), 'config' => array('step' => 'any', 'min' => 0)), 'discount' => array('id' => 'discount', 'title' => sprintf(__('Discount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->discount), 'config' => array('step' => 'any', 'min' => 0)), 'due_date' => array('id' => 'due_date', 'title' => __('Due date', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $invoice->due_date), 'description' => array('id' => 'description', 'title' => __('Description', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'class' => 'widefat', 'value' => $invoice->description), 'notes' => array('id' => 'notes', 'title' => __('Notes', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA, 'class' => 'widefat', 'value' => $invoice->get_notes_desc()), 'invoice_id' => array('id' => 'invoice_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($this->data['action'])), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $this->data['action']), 'separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'execute' => array('id' => 'execute', 'title' => __('Execute status change actions on Save (add/remove membership)', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'value' => true), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => __('Cancel', 'membership2'), 'value' => __('Cancel', 'membership2'), 'url' => esc_url_raw(remove_query_arg(array('action', 'invoice_id'))), 'class' => 'wpmui-field-button button'), 'submit' => array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Changes', 'membership2')));
if ($invoice->id > 0) {
$fields['user_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
$fields['membership_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
$fields['txt_membership']['value'] = $this->data['memberships'][$invoice->membership_id];
$fields['txt_created']['value'] = MS_Helper_Period::format_date($invoice->invoice_date);
} else {
unset($fields['txt_user']);
unset($fields['txt_membership']);
unset($fields['txt_created']);
unset($fields['txt_separator']);
}
return apply_filters('ms_view_billing_edit_prepare_fields', $fields, $this);
}
示例4: column_discount
public function column_discount($item)
{
$html = '';
if (MS_Addon_Coupon_Model::TYPE_VALUE == $item->discount_type) {
$html = sprintf('%s %s', MS_Plugin::instance()->settings->currency, MS_Helper_Billing::format_price($item->discount));
} elseif (MS_Addon_Coupon_Model::TYPE_PERCENT == $item->discount_type) {
$html = $item->discount . ' %';
} else {
$html = apply_filters('ms_addon_coupon_helper_listtable_column_discount', $item->discount);
}
return $html;
}
示例5: set_gateway
/**
* Sets the parent gateway of the API object.
*
* The parent gateway object is used to fetch the API keys.
*
* @since 1.0.1.0
* @param MS_Gateway $gateway The parent gateway.
*/
public function set_gateway($gateway)
{
static $Stripe_Loaded = false;
if (!$Stripe_Loaded) {
require_once MS_Plugin::instance()->dir . '/lib/stripe-php/lib/Stripe.php';
do_action('ms_gateway_stripe_load_stripe_lib_after', $this);
$Stripe_Loaded = true;
}
$this->_gateway = $gateway;
$secret_key = $this->_gateway->get_secret_key();
M2_Stripe::setApiKey($secret_key);
}
示例6: prepare_fields
/**
* Prepare html fields.
*
* @since 1.0.0
*
* @return array
*/
function prepare_fields()
{
$invoice = $this->data['invoice'];
$currency = MS_Plugin::instance()->settings->currency;
$fields = array('txt_user' => array('id' => 'txt_user', 'title' => __('Username', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => $this->data['users'][$invoice->user_id]), 'txt_membership' => array('id' => 'txt_membership', 'title' => __('Membership', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'status' => array('id' => 'status', 'title' => __('Status', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'field_options' => MS_Model_Invoice::get_status_types(), 'value' => $invoice->status), 'user_id' => array('id' => 'user_id', 'title' => __('Username', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->user_id, 'field_options' => $this->data['users']), 'membership_id' => array('id' => 'membership_id', 'title' => __('Membership', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->membership_id, 'field_options' => $this->data['memberships']), 'description' => array('id' => 'description', 'title' => __('Description', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'value' => $invoice->description), 'amount' => array('id' => 'amount', 'title' => sprintf(__('Amount (%s)', MS_TEXT_DOMAIN), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'value' => $invoice->amount), 'discount' => array('id' => 'discount', 'title' => sprintf(__('Discount (%s)', MS_TEXT_DOMAIN), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'value' => $invoice->discount), 'due_date' => array('id' => 'due_date', 'title' => __('Due date', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $invoice->due_date), 'notes' => array('id' => 'notes', 'title' => __('Notes', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA, 'value' => $invoice->get_notes_desc()), 'invoice_id' => array('id' => 'invoice_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($this->data['action'])), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $this->data['action']), 'separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'execute' => array('id' => 'execute', 'title' => __('Execute status change actions on Save (add/remove membership)', MS_TEXT_DOMAIN), 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'value' => true), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => __('Cancel', MS_TEXT_DOMAIN), 'value' => __('Cancel', MS_TEXT_DOMAIN), 'url' => esc_url_raw(remove_query_arg(array('action', 'invoice_id'))), 'class' => 'wpmui-field-button button'), 'submit' => array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Changes', MS_TEXT_DOMAIN)));
if ($invoice->id > 0) {
$fields['user_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
$fields['membership_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
$fields['txt_membership']['value'] = $this->data['memberships'][$invoice->membership_id];
} else {
unset($fields['txt_user']);
unset($fields['txt_membership']);
unset($fields['txt_separator']);
}
return apply_filters('ms_view_billing_edit_prepare_fields', $fields, $this);
}
示例7: to_html
/**
* Displays the settings form.
*
* @since 1.0.0
* @return string
*/
public function to_html()
{
if (!empty($_REQUEST['full_popup'])) {
$show_wizard_done = true;
} else {
$show_wizard_done = MS_Plugin::instance()->settings->is_first_membership;
}
if ($show_wizard_done) {
$this->form_type = 'full';
$code = $this->html_full_form();
} else {
$this->form_type = 'short';
$code = $this->html_short_form();
}
return $code;
}
示例8: get_tabs
/**
* Get available tabs.
*
* @since 1.0.0
*
* @return array The tabs configuration.
*/
public function get_tabs()
{
$tabs = array('general' => array('title' => __('General', MS_TEXT_DOMAIN)), 'shortcodes' => array('title' => __('Shortcodes', MS_TEXT_DOMAIN)), 'network' => array('title' => __('Network-Wide Protection', MS_TEXT_DOMAIN)), 'advanced' => array('title' => __('Advanced Settings', MS_TEXT_DOMAIN)), 'api' => array('title' => __('API Docs', MS_TEXT_DOMAIN), 'url' => MS_Plugin::instance()->url . 'docs/namespaces/default.html', 'target' => '_blank'));
if (!is_multisite()) {
unset($tabs['network']);
}
lib2()->array->equip_get('page');
$def_key = MS_Controller_Plugin::MENU_SLUG . '-help';
$page = sanitize_html_class($_GET['page'], $def_key);
foreach ($tabs as $key => $tab) {
if (empty($tabs[$key]['url'])) {
$tabs[$key]['url'] = sprintf('admin.php?page=%1$s&tab=%2$s', esc_attr($page), esc_attr($key));
}
}
return apply_filters('ms_controller_help_get_tabs', $tabs, $this);
}
示例9: init_adminbar
/**
* Initialize the Admin-Bar after we have determined the current user.
*
* @since 1.0.0
*/
public function init_adminbar()
{
$this->simulate = MS_Factory::load('MS_Model_Simulate');
// Hide WP toolbar in front end to not admin users
if (!$this->is_admin_user() && MS_Plugin::instance()->settings->hide_admin_bar) {
add_filter('show_admin_bar', '__return_false');
$this->add_action('wp_before_admin_bar_render', 'customize_toolbar_front', 999);
}
// Customize WP toolbar for admin users
if ($this->is_admin_user()) {
$this->add_action('wp_before_admin_bar_render', 'customize_toolbar', 999);
$this->add_action('add_admin_bar_menus', 'admin_bar_manager');
$this->add_action('admin_enqueue_scripts', 'enqueue_scripts');
$this->add_action('wp_enqueue_scripts', 'enqueue_scripts');
}
}
示例10: to_html
/**
* Overrides parent's to_html() method.
*
* Creates an output buffer, outputs the HTML and grabs the buffer content before releasing it.
* Creates a wrapper 'ms-wrap' HTML element to contain content and navigation. The content inside
* the navigation gets loaded with dynamic method calls.
* e.g. if key is 'settings' then render_settings() gets called, if 'bob' then render_bob().
*
* @since 1.0.0
* @api
*
* @return string
*/
public function to_html()
{
$form_fields = $this->prepare_fields();
$setup_url = MS_Controller_Plugin::get_admin_url('setup');
ob_start();
// Render tabbed interface.
?>
<div class="ms-wrap wrap">
<form class="ms-welcome-box" action="<?php
echo esc_url($setup_url);
?>
" method="POST">
<h2 class="ms-welcome-title">
<?php
_e('Welcome!', MS_TEXT_DOMAIN);
?>
</h2>
<div class="ms-welcome-text">
<?php
_e('Hello and welcome to <strong>Membership2</strong> by WPMU DEV. Please follow this simple set-up<br />wizard to help us determine the settings that are most relevant to your needs. Don\'t worry, you<br />can always change these settings in the future.', MS_TEXT_DOMAIN);
?>
</div>
<div class="ms-welcome-image-box">
<img src="<?php
echo esc_attr(MS_Plugin::instance()->url);
?>
app/assets/images/welcome.png" class="ms-welcome-image" />
</div>
<?php
foreach ($form_fields as $field) {
MS_Helper_Html::html_element($field);
}
?>
</form>
</div>
<?php
return ob_get_clean();
}
示例11: wizard_tracker
/**
* Track wizard step.
*
* Save current step.
*
* since 1.0.0
*
* @param string $step Optional. The step to save. Default to current step.
* @param boolean $end_wizard Optional. Whether end the wizard mode.
* @return string The current step.
*/
public function wizard_tracker($step = null, $end_wizard = false)
{
$settings = MS_Plugin::instance()->settings;
if (empty($step)) {
$step = $this->get_step();
}
if (MS_Plugin::is_wizard()) {
$settings->wizard_step = $step;
if ($end_wizard) {
$settings->initial_setup = false;
}
$settings->save();
}
do_action('ms_controller_membership_wizard_tracker', $step, $end_wizard, $settings, $this);
}
示例12: body_class
/**
* Appends classes to the HTML body that identify all memberships that the
* current user is registered to. This allows webdesigners to adjust layout
* or hide elements based on the membership a user has.
*
* @since 1.0.0
*
* @param array $class Class-names to attach to the body.
* @return array Modified class-names to attach to the body.
*/
public function body_class($classes)
{
$member = MS_Model_Member::get_current_member();
if (!$member->is_logged_in()) {
$classes[] = 'ms-guest';
} else {
$classes[] = 'ms-member';
$classes[] = 'ms-member-' . $member->id;
}
$info = MS_Plugin::instance()->controller->get_access_info();
foreach ($info['memberships'] as $membership_id) {
$classes[] = 'ms-' . absint($membership_id);
}
return $classes;
}
示例13: enqueue_scripts
/**
* Load Membership admin scripts.
*
* @since 1.0.0
*/
public function enqueue_scripts()
{
$active_tab = $this->get_active_tab();
do_action('ms_controller_settings_enqueue_scripts_' . $active_tab);
$plugin_url = MS_Plugin::instance()->url;
$version = MS_Plugin::instance()->version;
$initial_url = MS_Controller_Plugin::get_admin_url();
$data = array('ms_init' => array(), 'initial_url' => $initial_url);
$data['ms_init'][] = 'view_settings';
switch ($active_tab) {
case self::TAB_PAYMENT:
add_thickbox();
$data['ms_init'][] = 'view_settings_payment';
break;
case self::TAB_MESSAGES:
$data['ms_init'][] = 'view_settings_protection';
break;
case self::TAB_EMAILS:
$data['ms_init'][] = 'view_settings_automated_msg';
break;
case self::TAB_GENERAL:
$data['ms_init'][] = 'view_settings_setup';
break;
}
lib3()->ui->data('ms_data', $data);
wp_enqueue_script('ms-admin');
}
示例14: ajax_link_data_transaction
/**
* Ajax action handler used by the transaction logs list to change a
* transaction log entry.
*
* Returns a list of requested items
*
* @since 1.0.1.0
*/
public function ajax_link_data_transaction()
{
$resp = array();
$fields = array('get', 'for');
if (self::validate_required($fields) && $this->verify_nonce()) {
$type = $_POST['get'];
$id = intval($_POST['for']);
$settings = MS_Plugin::instance()->settings;
if ('subscriptions' == $type) {
$member = MS_Factory::load('MS_Model_Member', $id);
$resp[0] = __('Select a subscription', 'membership2');
$active = array();
$inactive = array();
foreach ($member->subscriptions as $subscription) {
if ($subscription->is_system()) {
continue;
}
$membership = $subscription->get_membership();
if ($membership->is_free()) {
$price = __('Free', 'membership2');
} else {
$price = sprintf('%s %s', $settings->currency, MS_Helper_Billing::format_price($membership->price));
}
$line = sprintf(__('Membership: %s, Base price: %s', 'membership2'), $membership->name, $price);
if ($subscription->is_expired()) {
$inactive[$subscription->id] = $line;
} else {
$active[$subscription->id] = $line;
}
}
if (!count($active) && !count($inactive)) {
$resp[0] = __('No subscriptions found', 'membership2');
} else {
if (count($active)) {
$resp[__('Active Subscriptions', 'membership2')] = $active;
}
if (count($inactive)) {
$resp[__('Expired Subscriptions', 'membership2')] = $inactive;
}
}
} elseif ('invoices' == $type) {
$subscription = MS_Factory::load('MS_Model_Relationship', $id);
$invoices = $subscription->get_invoices();
$resp[0] = __('Select an invoice', 'membership2');
$unpaid = array();
$paid = array();
foreach ($invoices as $invoice) {
$line = sprintf(__('Invoice: %s from %s (%s)', 'membership2'), $invoice->get_invoice_number(), $invoice->due_date, $invoice->currency . ' ' . MS_Helper_Billing::format_price($invoice->total));
if ($invoice->is_paid()) {
$paid[$invoice->id] = $line;
} else {
$unpaid[$invoice->id] = $line;
}
}
if (!count($unpaid) && !count($paid)) {
$resp[0] = __('No invoices found', 'membership2');
} else {
if (count($unpaid)) {
$resp[__('Unpaid Invoices', 'membership2')] = $unpaid;
}
if (count($paid)) {
$resp[__('Paid Invoices', 'membership2')] = $paid;
}
}
}
}
echo json_encode($resp);
exit;
}
示例15: remove_old_copy
/**
* Used when upgrading from Membership to M2. If both Membership and
* Protected Content are installed when upgrading then the old
* "protected-content" folder may survive the upgrade and needs to be
* manually removed.
*
* @since 1.0.0
*/
private static function remove_old_copy()
{
$new_dir = WP_PLUGIN_DIR . '/membership';
$old_dir = WP_PLUGIN_DIR . '/protected-content';
$old_plugins = array('protected-content/protected-content.php', 'membership/membershippremium.php');
$new_plugin = plugin_basename(MS_Plugin::instance()->file);
// Make sure that the current plugin is the official M2 one.
if (false === strpos(MS_Plugin::instance()->dir, $new_dir)) {
// Cancel: This plugin is not the official plugin (maybe a backup or beta version)
if (false !== strpos(MS_Plugin::instance()->dir, $old_dir)) {
lib3()->ui->admin_message(__('<b>Upgrade warning</b>:<br>The Membership 2 plugin is installed in an deprecated folder. Some users did report issues when the plugin is installed in this directory.<br>To fix this issue please follow these steps:<br><br>1. Delete* the old Membership Premium plugin if it is still installed.<br>2. Delete* the Membership 2 plugin.<br>3. Re-install Membership 2 from the WPMU Dashboard - your existing data is not affected by this.<br><br>*) <em>Only deactivating the plugins does not work, you have to delete them.</em>', 'membership2'), 'error');
}
return;
}
// 1. See if there is a old copy of the plugin directory. Delete it.
if (is_dir($old_dir) && is_file($old_dir . '/protected-content.php')) {
// Looks like the old version of this plugin is still installed. Remove it.
try {
unlink($old_dir . '/protected-content.php');
array_map('unlink', glob("{$old_dir}/*.*"));
rmdir($old_dir);
} catch (Exception $e) {
// Something went wrong when removing the old plugin.
}
}
// 2. See if WordPress uses an old plugin in the DB. Update it.
if (is_multisite()) {
$global_plugins = (array) get_site_option('active_sitewide_plugins', array());
foreach ($global_plugins as $key => $the_path) {
if (in_array($the_path, $old_plugins)) {
$global_plugins[$key] = $new_plugin;
}
}
update_site_option('active_sitewide_plugins', $global_plugins);
}
$site_plugins = (array) get_option('active_plugins', array());
foreach ($site_plugins as $key => $the_path) {
if (in_array($the_path, $old_plugins)) {
$site_plugins[$key] = $new_plugin;
}
}
update_option('active_plugins', $site_plugins);
}