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


PHP _get_dropins函数代码示例

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


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

示例1: execute

 public static function execute($params)
 {
     // Set progress
     Ai1wm_Status::info(__('Activating plugins...', AI1WM_PLUGIN_NAME));
     // Open the archive file for reading
     $archive = new Ai1wm_Extractor(ai1wm_archive_path($params));
     // Include WordPress files
     $include_files = array_keys(_get_dropins());
     // Include mu-plugins files
     $include_files = array_merge($include_files, array(AI1WM_MUPLUGINS_NAME));
     // Unpack WordPress files and mu-plugins files
     $archive->extract_by_files_array(WP_CONTENT_DIR, $include_files);
     // Close the archive file
     $archive->close();
     // Set progress
     Ai1wm_Status::info(__('Done activating plugins...', AI1WM_PLUGIN_NAME));
     return $params;
 }
开发者ID:sonnetmedia,项目名称:otherpress.com,代码行数:18,代码来源:class-ai1wm-import-plugins.php

示例2: execute

 public static function execute($params)
 {
     // Set shutdown handler
     @register_shutdown_function('Ai1wm_Import_Done::shutdown');
     // Check multisite.json file
     if (true === is_file(ai1wm_multisite_path($params))) {
         // Read multisite.json file
         $handle = fopen(ai1wm_multisite_path($params), 'r');
         if ($handle === false) {
             throw new Ai1wm_Import_Exception(__('Unable to read multisite.json file', AI1WM_PLUGIN_NAME));
         }
         // Parse multisite.json file
         $multisite = fread($handle, filesize(ai1wm_multisite_path($params)));
         $multisite = json_decode($multisite);
         // Close handle
         fclose($handle);
         // Activate plugins
         if (isset($multisite->Plugins) && ($active_sitewide_plugins = $multisite->Plugins)) {
             activate_plugins($active_sitewide_plugins, null, is_multisite());
         }
     }
     // Open the archive file for reading
     $archive = new Ai1wm_Extractor(ai1wm_archive_path($params));
     // Include WordPress files
     $include_files = array_keys(_get_dropins());
     // Include mu-plugins files
     $include_files = array_merge($include_files, array(AI1WM_MUPLUGINS_NAME));
     // Unpack WordPress files and mu-plugins files
     $archive->extract_by_files_array(WP_CONTENT_DIR, $include_files);
     // Close the archive file
     $archive->close();
     // Load must-use plugins
     foreach (wp_get_mu_plugins() as $mu_plugin) {
         include_once $mu_plugin;
     }
     return $params;
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:37,代码来源:class-ai1wm-import-done.php

示例3: get_dropins

/**
 * Check the wp-content directory and retrieve all drop-ins with any plugin data.
 *
 * @since 3.0.0
 * @return array Key is the file path and the value is an array of the plugin data.
 */
function get_dropins()
{
    $dropins = array();
    $plugin_files = array();
    $_dropins = _get_dropins();
    // These exist in the wp-content directory
    if ($plugins_dir = @opendir(WP_CONTENT_DIR)) {
        while (($file = readdir($plugins_dir)) !== false) {
            if (isset($_dropins[$file])) {
                $plugin_files[] = $file;
            }
        }
    } else {
        return $dropins;
    }
    @closedir($plugins_dir);
    if (empty($plugin_files)) {
        return $dropins;
    }
    foreach ($plugin_files as $plugin_file) {
        if (!is_readable(WP_CONTENT_DIR . "/{$plugin_file}")) {
            continue;
        }
        $plugin_data = get_plugin_data(WP_CONTENT_DIR . "/{$plugin_file}", false, false);
        //Do not apply markup/translate as it'll be cached.
        if (empty($plugin_data['Name'])) {
            $plugin_data['Name'] = $plugin_file;
        }
        $dropins[$plugin_file] = $plugin_data;
    }
    uksort($dropins, 'strnatcasecmp');
    return $dropins;
}
开发者ID:fka2004,项目名称:webkit,代码行数:39,代码来源:plugin.php

示例4: single_row

 /**
  * @global string $status
  * @global int $page
  * @global string $s
  * @global array $totals
  * @param array $item
  */
 public function single_row($item)
 {
     global $status, $page, $s, $totals;
     list($plugin_file, $plugin_data) = $item;
     $context = $status;
     $screen = $this->screen;
     // Pre-order.
     $actions = array('deactivate' => '', 'activate' => '', 'details' => '', 'edit' => '', 'delete' => '');
     if ('mustuse' == $context) {
         $is_active = true;
     } elseif ('dropins' == $context) {
         $dropins = _get_dropins();
         $plugin_name = $plugin_file;
         if ($plugin_file != $plugin_data['Name']) {
             $plugin_name .= '<br/>' . $plugin_data['Name'];
         }
         if (true === $dropins[$plugin_file][1]) {
             // Doesn't require a constant
             $is_active = true;
             $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>';
         } elseif (defined($dropins[$plugin_file][1]) && constant($dropins[$plugin_file][1])) {
             // Constant is true
             $is_active = true;
             $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>';
         } else {
             $is_active = false;
             $description = '<p><strong>' . $dropins[$plugin_file][0] . ' <span class="attention">' . __('Inactive:') . '</span></strong> ' . sprintf(__('Requires <code>%s</code> in <code>wp-config.php</code>.'), "define('" . $dropins[$plugin_file][1] . "', true);") . '</p>';
         }
         if ($plugin_data['Description']) {
             $description .= '<p>' . $plugin_data['Description'] . '</p>';
         }
     } else {
         if ($screen->in_admin('network')) {
             $is_active = is_plugin_active_for_network($plugin_file);
         } else {
             $is_active = is_plugin_active($plugin_file);
         }
         if ($screen->in_admin('network')) {
             if ($is_active) {
                 if (current_user_can('manage_network_plugins')) {
                     $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
                 }
             } else {
                 if (current_user_can('manage_network_plugins')) {
                     $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
                 }
                 if (current_user_can('delete_plugins') && !is_plugin_active($plugin_file)) {
                     $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
                 }
             }
         } else {
             if ($is_active) {
                 $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
             } else {
                 $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
                 if (!is_multisite() && current_user_can('delete_plugins')) {
                     $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
                 }
             }
             // end if $is_active
         }
         // end if $screen->in_admin( 'network' )
         if ((!is_multisite() || $screen->in_admin('network')) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file)) {
             $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
         }
     }
     // end if $context
     $prefix = $screen->in_admin('network') ? 'network_admin_' : '';
     /**
      * Filter the action links displayed for each plugin in the Plugins list table.
      *
      * The dynamic portion of the hook name, `$prefix`, refers to the context the
      * action links are displayed in. The 'network_admin_' prefix is used if the
      * current screen is the Network plugins list table. The prefix is empty ('')
      * if the current screen is the site plugins list table.
      *
      * The default action links for the Network plugins list table include
      * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'.
      *
      * The default action links for the site plugins list table include
      * 'Activate', 'Deactivate', and 'Edit', for a network site, and
      * 'Activate', 'Deactivate', 'Edit', and 'Delete' for a single site.
      *
      * @since 2.5.0
      *
      * @param array  $actions     An array of plugin action links.
      * @param string $plugin_file Path to the plugin file.
      * @param array  $plugin_data An array of plugin data.
      * @param string $context     The plugin context. Defaults are 'All', 'Active',
      *                            'Inactive', 'Recently Activated', 'Upgrade',
      *                            'Must-Use', 'Drop-ins', 'Search'.
      */
     $actions = apply_filters($prefix . 'plugin_action_links', array_filter($actions), $plugin_file, $plugin_data, $context);
//.........这里部分代码省略.........
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:101,代码来源:class-wp-plugins-list-table.php

示例5: single_row

 function single_row($plugin_file, $plugin_data)
 {
     global $status, $page, $s;
     $context = $status;
     $screen = get_current_screen();
     // preorder
     $actions = array('network_deactivate' => '', 'deactivate' => '', 'network_only' => '', 'activate' => '', 'network_activate' => '', 'edit' => '', 'delete' => '');
     if ('mustuse' == $context) {
         $is_active = true;
     } elseif ('dropins' == $context) {
         $dropins = _get_dropins();
         $plugin_name = $plugin_file;
         if ($plugin_file != $plugin_data['Name']) {
             $plugin_name .= '<br/>' . $plugin_data['Name'];
         }
         if (true === $dropins[$plugin_file][1]) {
             // Doesn't require a constant
             $is_active = true;
             $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>';
         } elseif (constant($dropins[$plugin_file][1])) {
             // Constant is true
             $is_active = true;
             $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>';
         } else {
             $is_active = false;
             $description = '<p><strong>' . $dropins[$plugin_file][0] . ' <span class="attention">' . __('Inactive:') . '</span></strong> ' . sprintf(__('Requires <code>%s</code> in <code>wp-config.php</code>.'), "define('" . $dropins[$plugin_file][1] . "', true);") . '</p>';
         }
         if ($plugin_data['Description']) {
             $description .= '<p>' . $plugin_data['Description'] . '</p>';
         }
     } else {
         $is_active_for_network = is_plugin_active_for_network($plugin_file);
         if ($screen->is_network) {
             $is_active = $is_active_for_network;
         } else {
             $is_active = is_plugin_active($plugin_file);
         }
         if ($is_active_for_network && !is_super_admin() && !$screen->is_network) {
             return;
         }
         if ($screen->is_network) {
             if ($is_active_for_network) {
                 if (current_user_can('manage_network_plugins')) {
                     $actions['network_deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
                 }
             } else {
                 if (current_user_can('manage_network_plugins')) {
                     $actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
                 }
                 if (current_user_can('delete_plugins') && !is_plugin_active($plugin_file)) {
                     $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
                 }
             }
         } else {
             if ($is_active) {
                 $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
             } else {
                 $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
                 if (!is_multisite() && current_user_can('delete_plugins')) {
                     $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
                 }
             }
             // end if $is_active
         }
         // end if $screen->is_network
         if ((!is_multisite() || $screen->is_network) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file)) {
             $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
         }
     }
     // end if $context
     $prefix = $screen->is_network ? 'network_admin_' : '';
     $actions = apply_filters($prefix . 'plugin_action_links', array_filter($actions), $plugin_file, $plugin_data, $context);
     $actions = apply_filters($prefix . "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context);
     $class = $is_active ? 'active' : 'inactive';
     $checkbox_id = "checkbox_" . md5($plugin_data['Name']);
     $checkbox = in_array($status, array('mustuse', 'dropins')) ? '' : "<input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $plugin_data['Name'] . "</label>";
     if ('dropins' != $context) {
         $description = '<p>' . ($plugin_data['Description'] ? $plugin_data['Description'] : '&nbsp;') . '</p>';
         $plugin_name = $plugin_data['Name'];
     }
     $id = sanitize_title($plugin_name);
     echo "<tr id='{$id}' class='{$class}'>";
     list($columns, $hidden) = $this->get_column_info();
     foreach ($columns as $column_name => $column_display_name) {
         $style = '';
         if (in_array($column_name, $hidden)) {
             $style = ' style="display:none;"';
         }
         switch ($column_name) {
             case 'cb':
                 echo "<th scope='row' class='check-column'>{$checkbox}</th>";
                 break;
             case 'name':
                 echo "<td class='plugin-title'{$style}><strong>{$plugin_name}</strong>";
                 echo $this->row_actions($actions, true);
                 echo "</td>";
                 break;
             case 'description':
                 echo "<td class='column-description desc'{$style}>\n\t\t\t\t\t\t<div class='plugin-description'>{$description}</div>\n\t\t\t\t\t\t<div class='{$class} second plugin-version-author-uri'>";
                 $plugin_meta = array();
//.........这里部分代码省略.........
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:101,代码来源:class-wp-plugins-list-table.php

示例6: _restore_drop_ins

 /**
  * Restore backed-up drop-ins.
  *
  * @since 4.2.0
  *
  * @access private
  */
 private function _restore_drop_ins()
 {
     $di_bu_dir = WP_CONTENT_DIR . '/drop-ins-backup';
     foreach (_get_dropins() as $file_to_move => $v) {
         if (file_exists($di_bu_dir . '/' . $file_to_move)) {
             rename($di_bu_dir . '/' . $file_to_move, WP_CONTENT_DIR . '/' . $file_to_move);
         }
     }
     if (is_dir($di_bu_dir)) {
         rmdir($di_bu_dir);
     }
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:19,代码来源:includesPlugin.php

示例7: print_plugins_table

/**
 * @ignore
 *
 * @param array $plugins
 * @param string $context
 */
function print_plugins_table($plugins, $context = '')
{
    global $page;
    $checkbox = !in_array($context, array('mustuse', 'dropins')) ? '<input type="checkbox" />' : '';
    ?>
<table class="widefat" cellspacing="0" id="<?php 
    echo $context;
    ?>
-plugins-table">
	<thead>
	<tr>
		<th scope="col" class="manage-column check-column"><?php 
    echo $checkbox;
    ?>
</th>
		<th scope="col" class="manage-column"><?php 
    _e('Plugin');
    ?>
</th>
		<th scope="col" class="manage-column"><?php 
    _e('Description');
    ?>
</th>
	</tr>
	</thead>

	<tfoot>
	<tr>
		<th scope="col" class="manage-column check-column"><?php 
    echo $checkbox;
    ?>
</th>
		<th scope="col" class="manage-column"><?php 
    _e('Plugin');
    ?>
</th>
		<th scope="col" class="manage-column"><?php 
    _e('Description');
    ?>
</th>
	</tr>
	</tfoot>

	<tbody class="plugins">
<?php 
    if (empty($plugins)) {
        echo '<tr>
			<td colspan="3">' . __('No plugins to show') . '</td>
		</tr>';
    }
    foreach ((array) $plugins as $plugin_file => $plugin_data) {
        // preorder
        $actions = array('network_deactivate' => '', 'deactivate' => '', 'network_only' => '', 'activate' => '', 'network_activate' => '', 'edit' => '', 'delete' => '');
        if ('mustuse' == $context) {
            $is_active = true;
        } elseif ('dropins' == $context) {
            $dropins = _get_dropins();
            $plugin_name = $plugin_file;
            if ($plugin_file != $plugin_data['Name']) {
                $plugin_name .= '<br/>' . $plugin_data['Name'];
            }
            if (true === $dropins[$plugin_file][1]) {
                // Doesn't require a constant
                $is_active = true;
                $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>';
            } elseif (constant($dropins[$plugin_file][1])) {
                // Constant is true
                $is_active = true;
                $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>';
            } else {
                $is_active = false;
                $description = '<p><strong>' . $dropins[$plugin_file][0] . ' <span class="attention">' . __('Inactive:') . '</span></strong> ' . sprintf(__('Requires <code>%s</code> in <code>wp-config.php</code>.'), "define('" . $dropins[$plugin_file][1] . "', true);") . '</p>';
            }
            if ($plugin_data['Description']) {
                $description .= '<p>' . $plugin_data['Description'] . '</p>';
            }
        } else {
            $is_active_for_network = is_plugin_active_for_network($plugin_file);
            $is_active = $is_active_for_network || is_plugin_active($plugin_file);
            if ($is_active_for_network && !is_super_admin()) {
                continue;
            }
            if ($is_active) {
                if ($is_active_for_network) {
                    if (is_super_admin()) {
                        $actions['network_deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
                    }
                } else {
                    $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
                }
            } else {
                if (is_multisite() && is_network_only_plugin($plugin_file)) {
                    $actions['network_only'] = '<span title="' . __('This plugin can only be activated for all sites in a network') . '">' . __('Network Only') . '</span>';
                } else {
//.........这里部分代码省略.........
开发者ID:google-code-backups,项目名称:pumpmyvote,代码行数:101,代码来源:plugins.php

示例8: single_row

 /**
  * @global string $status
  * @global int $page
  * @global string $s
  * @global array $totals
  *
  * @param array $item
  */
 public function single_row($item)
 {
     global $status, $page, $s, $totals;
     list($plugin_file, $plugin_data) = $item;
     $context = $status;
     $screen = $this->screen;
     // Pre-order.
     $actions = array('deactivate' => '', 'activate' => '', 'details' => '', 'edit' => '', 'delete' => '');
     // Do not restrict by default
     $restrict_network_active = false;
     $restrict_network_only = false;
     if ('mustuse' === $context) {
         $is_active = true;
     } elseif ('dropins' === $context) {
         $dropins = _get_dropins();
         $plugin_name = $plugin_file;
         if ($plugin_file != $plugin_data['Name']) {
             $plugin_name .= '<br/>' . $plugin_data['Name'];
         }
         if (true === $dropins[$plugin_file][1]) {
             // Doesn't require a constant
             $is_active = true;
             $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>';
         } elseif (defined($dropins[$plugin_file][1]) && constant($dropins[$plugin_file][1])) {
             // Constant is true
             $is_active = true;
             $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>';
         } else {
             $is_active = false;
             $description = '<p><strong>' . $dropins[$plugin_file][0] . ' <span class="error-message">' . __('Inactive:') . '</span></strong> ' . sprintf(__('Requires %1$s in %2$s file.'), "<code>define('" . $dropins[$plugin_file][1] . "', true);</code>", '<code>wp-config.php</code>') . '</p>';
         }
         if ($plugin_data['Description']) {
             $description .= '<p>' . $plugin_data['Description'] . '</p>';
         }
     } else {
         if ($screen->in_admin('network')) {
             $is_active = is_plugin_active_for_network($plugin_file);
         } else {
             $is_active = is_plugin_active($plugin_file);
             $restrict_network_active = is_multisite() && is_plugin_active_for_network($plugin_file);
             $restrict_network_only = is_multisite() && is_network_only_plugin($plugin_file) && !$is_active;
         }
         if ($screen->in_admin('network')) {
             if ($is_active) {
                 if (current_user_can('manage_network_plugins')) {
                     /* translators: %s: plugin name */
                     $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" aria-label="' . esc_attr(sprintf(__('Network deactivate %s'), $plugin_data['Name'])) . '">' . __('Network Deactivate') . '</a>';
                 }
             } else {
                 if (current_user_can('manage_network_plugins')) {
                     /* translators: %s: plugin name */
                     $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" class="edit" aria-label="' . esc_attr(sprintf(__('Network Activate %s'), $plugin_data['Name'])) . '">' . __('Network Activate') . '</a>';
                 }
                 if (current_user_can('delete_plugins') && !is_plugin_active($plugin_file)) {
                     /* translators: %s: plugin name */
                     $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" class="delete" aria-label="' . esc_attr(sprintf(__('Delete %s'), $plugin_data['Name'])) . '">' . __('Delete') . '</a>';
                 }
             }
         } else {
             if ($restrict_network_active) {
                 $actions = array('network_active' => __('Network Active'));
             } elseif ($restrict_network_only) {
                 $actions = array('network_only' => __('Network Only'));
             } elseif ($is_active) {
                 /* translators: %s: plugin name */
                 $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" aria-label="' . esc_attr(sprintf(__('Deactivate %s'), $plugin_data['Name'])) . '">' . __('Deactivate') . '</a>';
             } else {
                 /* translators: %s: plugin name */
                 $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" class="edit" aria-label="' . esc_attr(sprintf(__('Activate %s'), $plugin_data['Name'])) . '">' . __('Activate') . '</a>';
                 if (!is_multisite() && current_user_can('delete_plugins')) {
                     /* translators: %s: plugin name */
                     $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" class="delete" aria-label="' . esc_attr(sprintf(__('Delete %s'), $plugin_data['Name'])) . '">' . __('Delete') . '</a>';
                 }
             }
             // end if $is_active
         }
         // end if $screen->in_admin( 'network' )
         if ((!is_multisite() || $screen->in_admin('network')) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file)) {
             /* translators: %s: plugin name */
             $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" class="edit" aria-label="' . esc_attr(sprintf(__('Edit %s'), $plugin_data['Name'])) . '">' . __('Edit') . '</a>';
         }
     }
     // end if $context
     $actions = array_filter($actions);
     if ($screen->in_admin('network')) {
         /**
          * Filter the action links displayed for each plugin in the Network Admin Plugins list table.
          *
          * The default action links for the Network plugins list table include
          * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'.
          *
          * @since 3.1.0 As `{$prefix}_plugin_action_links`
//.........这里部分代码省略.........
开发者ID:jianqiangsong,项目名称:WordPress,代码行数:101,代码来源:class-wp-plugins-list-table.php

示例9: execute

 public static function execute($params)
 {
     // Read blogs.json file
     $handle = fopen(ai1wm_blogs_path($params), 'r');
     if ($handle === false) {
         throw new Ai1wm_Import_Exception('Unable to read blogs.json file');
     }
     // Parse blogs.json file
     $blogs = fread($handle, filesize(ai1wm_blogs_path($params)));
     $blogs = json_decode($blogs);
     // Close handle
     fclose($handle);
     // Set content offset
     if (isset($params['content_offset'])) {
         $content_offset = (int) $params['content_offset'];
     } else {
         $content_offset = 0;
     }
     // Set archive offset
     if (isset($params['archive_offset'])) {
         $archive_offset = (int) $params['archive_offset'];
     } else {
         $archive_offset = 0;
     }
     // Get total files
     if (isset($params['total_files'])) {
         $total_files = (int) $params['total_files'];
     } else {
         $total_files = 1;
     }
     // Get total size
     if (isset($params['total_size'])) {
         $total_size = (int) $params['total_size'];
     } else {
         $total_size = 1;
     }
     // Get processed files
     if (isset($params['processed'])) {
         $processed = (int) $params['processed'];
     } else {
         $processed = 0;
     }
     // What percent of files have we processed?
     $progress = (int) ($processed / $total_size * 100);
     // Set progress
     if (empty($content_offset)) {
         Ai1wm_Status::info(sprintf(__('Restoring %d files...<br />%d%% complete', AI1WM_PLUGIN_NAME), $total_files, $progress));
     }
     // Start time
     $start = microtime(true);
     // Flag to hold if all files have been processed
     $completed = true;
     // Open the archive file for reading
     $archive = new Ai1wm_Extractor(ai1wm_archive_path($params));
     // Set the file pointer to the one that we have saved
     $archive->set_file_pointer(null, $archive_offset);
     $old_paths = array();
     $new_paths = array();
     // Set extract paths
     foreach ($blogs as $blog) {
         if (defined('UPLOADBLOGSDIR')) {
             // Old sites dir style
             $old_paths[] = ai1wm_files_path($blog->Old->Id);
             $new_paths[] = ai1wm_files_path($blogs->New->Id);
             // New sites dir style
             $old_paths[] = ai1wm_sites_path($blog->Old->Id);
             $new_paths[] = ai1wm_files_path($blog->New->Id);
         } else {
             // Old sites dir style
             $old_paths[] = ai1wm_files_path($blog->Old->Id);
             $new_paths[] = ai1wm_sites_path($blog->New->Id);
             // New sites dir style
             $old_paths[] = ai1wm_sites_path($blog->Old->Id);
             $new_paths[] = ai1wm_sites_path($blog->New->Id);
         }
     }
     while ($archive->has_not_reached_eof()) {
         try {
             // Exclude WordPress files
             $exclude_files = array_keys(_get_dropins());
             // Exclude plugin files
             $exclude_files = array_merge($exclude_files, array(AI1WM_PACKAGE_NAME, AI1WM_MULTISITE_NAME, AI1WM_DATABASE_NAME, AI1WM_MUPLUGINS_NAME));
             // Extract a file from archive to WP_CONTENT_DIR
             if ($content_offset = $archive->extract_one_file_to(WP_CONTENT_DIR, $exclude_files, $old_paths, $new_paths, $content_offset, 10)) {
                 // Set progress
                 if ($processed += $content_offset) {
                     $progress = (int) ($processed / $total_size * 100);
                 }
                 // Set progress
                 Ai1wm_Status::info(sprintf(__('Restoring %d files...<br />%d%% complete', AI1WM_PLUGIN_NAME), $total_files, $progress));
                 // Set content offset
                 $params['content_offset'] = $content_offset;
                 // Set archive offset
                 $params['archive_offset'] = $archive_offset;
                 // Set completed flag
                 $params['completed'] = false;
                 // Close the archive file
                 $archive->close();
                 return $params;
             }
//.........这里部分代码省略.........
开发者ID:austinsatmosphere,项目名称:ifxweather,代码行数:101,代码来源:class-ai1wm-import-content.php


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