public static function wprc_install_theme_information()
    {
        global $tab, $themes_allowedtags, $wp_list_table, $wp_version;
        if (version_compare($wp_version, '3.4', '>=')) {
            $theme = themes_api('theme_information', array('slug' => stripslashes($_REQUEST['theme'])));
            if (is_wp_error($theme)) {
                wp_die($theme);
            }
            $wp_list_table = WPRC_Loader::getListTable('theme-install');
            iframe_header(__('Theme Install', 'installer'));
            $wp_list_table->theme_installer_single($theme);
            iframe_footer();
            exit;
        } else {
            $api = themes_api('theme_information', array('slug' => stripslashes($_REQUEST['theme'])));
            if (is_wp_error($api)) {
                wp_die($api);
            }
            // Sanitize HTML
            foreach ((array) $api->sections as $section_name => $content) {
                $api->sections[$section_name] = wp_kses($content, $themes_allowedtags);
            }
            foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) {
                if (isset($api->{$key})) {
                    $api->{$key} = wp_kses($api->{$key}, $themes_allowedtags);
                }
            }
            iframe_header(__('Theme Install', 'installer'));
            /*if ( empty($api->download_link) ) {
            			echo '<div id="message" class="error"><p>' . __('<strong>ERROR:</strong> This theme is currently not available. Please try again later.') . '</p></div>';
            			iframe_footer();
            			exit;
            		}*/
            if (!empty($api->tested) && version_compare($GLOBALS['wp_version'], $api->tested, '>')) {
                echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has <strong>not been tested</strong> with your current version of WordPress.', 'installer') . '</p></div>';
            } else {
                if (!empty($api->requires) && version_compare($GLOBALS['wp_version'], $api->requires, '<')) {
                    echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has not been marked as <strong>compatible</strong> with your version of WordPress.', 'installer') . '</p></div>';
                }
            }
            // Default to a "new" theme
            $type = 'install';
            // Check to see if this theme is known to be installed, and has an update awaiting it.
            $update_themes = get_site_transient('update_themes');
            if (false != $update_themes && is_object($update_themes) && isset($update_themes->response)) {
                foreach ((array) $update_themes->response as $theme_slug => $theme_info) {
                    if ($theme_slug === $api->slug && $theme_info['new_version'] == $api->version && (isset($api->download_link) && !empty($api->download_link) || isset($api->package) && !empty($api->package))) {
                        if (isset($api->download_link) && !empty($api->download_link)) {
                            $update_themes->response[$theme_slug]['package'] = $api->download_link;
                            set_site_transient('update_themes', $update_themes);
                            $theme_info['package'] = $update_themes->response[$theme_slug]['package'];
                        } else {
                            if (isset($api->package) && !empty($api->package)) {
                                $update_themes->response[$theme_slug]['package'] = $api->package;
                                set_site_transient('update_themes', $update_themes);
                                $theme_info['package'] = $update_themes->response[$theme_slug]['package'];
                            }
                        }
                    }
                    if ($theme_slug === $api->slug && (isset($theme_info['package']) && !empty($theme_info['package']))) {
                        $type = 'update_available';
                        $update_file = $theme_slug;
                        break;
                    }
                }
            }
            $themes = get_themes();
            foreach ((array) $themes as $this_theme) {
                if (is_array($this_theme) && $this_theme['Stylesheet'] == $api->slug) {
                    if ($this_theme['Version'] == $api->version) {
                        $type = 'latest_installed';
                    } elseif ($this_theme['Version'] > $api->version) {
                        $type = 'newer_installed';
                        $newer_version = $this_theme['Version'];
                    }
                    break;
                }
            }
            ?>

		<div class='available-theme'>
		<img src='<?php 
            echo esc_url($api->screenshot_url);
            ?>
' width='300' class="theme-preview-img" />
		<h3><?php 
            echo $api->name;
            ?>
</h3>
		<p><?php 
            printf(__('by %s', 'installer'), $api->author);
            ?>
</p>
		<p><?php 
            printf(__('Version: %s', 'installer'), $api->version);
            ?>
</p>

		<?php 
            $buttons = '<a class="button" id="cancel" href="#" onclick="tb_close();return false;">' . __('Cancel', 'installer') . '</a> ';
            if ($type == 'newer_installed' || ($type = 'latest_installed') || !empty($api->download_link)) {
                switch ($type) {
                    default:
                    case 'install':
                        if (current_user_can('install_themes')) {
                            $theme_url = wp_nonce_url(self_admin_url('update.php?action=install-theme&theme=' . $api->slug), 'install-theme_' . $api->slug);
                            if (isset($api->repository_id)) {
                                $theme_url = add_query_arg(array('repository_id' => $api->repository_id), $theme_url);
                            }
                            $buttons .= '<a class="button-primary" id="install" href="' . $theme_url . '" target="_parent">' . __('Install Now', 'installer') . '</a>';
                        }
                        break;
                    case 'update_available':
                        if (current_user_can('update_themes')) {
                            $theme_url = wp_nonce_url(self_admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file);
                            if (isset($api->repository_id)) {
                                $theme_url = add_query_arg(array('repository_id' => $api->repository_id), $theme_url);
                            }
                            $buttons .= '<a class="button-primary" id="install"	href="' . $theme_url . '" target="_parent">' . __('Install Update Now', 'installer') . '</a>';
                        }
                        break;
                    case 'newer_installed':
                        if (current_user_can('install_themes') || current_user_can('update_themes')) {
                            ?>
<p><?php 
                            printf(__('Newer version (%s) is installed.', 'installer'), $newer_version);
                            ?>
</p><?php 
                        }
                        break;
                    case 'latest_installed':
                        if (current_user_can('install_themes') || current_user_can('update_themes')) {
                            ?>
<p><?php 
                            _e('This version is already installed.', 'installer');
                            ?>
</p><?php 
                        }
                        break;
                }
            }
            /*elseif (isset($api->message) && !empty($api->message))
            		{
            			echo wp_kses($api->message, $themes_allowedtags);
            		}*/
            if (isset($api->message) && !empty($api->message) && (current_user_can('install_themes') || current_user_can('update_themes'))) {
                //echo wp_kses($api->message, $plugins_allowedtags);
                $message = WPRC_Functions::formatMessage($api->message);
                if (isset($api->message_type) && $api->message_type == 'notify') {
                    WPRC_AdminNotifier::addMessage('wprc-theme-info-' . $api->slug, $message);
                } else {
                    echo $message;
                }
            } elseif (!($type == 'newer_installed' || ($type = 'latest_installed')) && (isset($api->purchase_link) && !empty($api->purchase_link) && isset($api->price) && !empty($api->price))) {
                if (current_user_can('install_themes')) {
                    $purl = WPRC_Functions::sanitizeURL($api->purchase_link);
                    $return_url = rawurlencode(admin_url('theme-install.php?tab=theme-information&repository_id=' . $api->repository_id . '&theme=' . $api->slug));
                    $salt = rawurlencode($api->salt);
                    if (strpos($purl, '?')) {
                        $url_glue = '&';
                    } else {
                        $url_glue = '?';
                    }
                    $purl .= $url_glue . 'return_to=' . $return_url . '&rsalt=' . $salt;
                    $buttons .= '<a class="button-primary" id="install" href="' . $purl . '">' . sprintf(__('Buy %s', 'installer'), '(' . $api->currency->symbol . $api->price . ' ' . $api->currency->name . ')') . '</a>';
                }
            }
            ?>
		<br class="clear" />
		</div>

		<p class="action-button">
		<?php 
            echo $buttons;
            ?>
		<br class="clear" />
		</p>
		<?php 
            if (isset($api->rauth) && $api->rauth == false) {
                ?>
		<p><?php 
                _e('Authorization Failed!', 'installer');
                ?>
</p>
		<?php 
            }
            ?>

		<?php 
            iframe_footer();
            exit;
        }
    }
<?php

if (!defined('ABSPATH')) {
    die('Security check');
}
if (!current_user_can('manage_options')) {
    die('Access Denied');
}
// include needed files
WPRC_Loader::includeWPListTable();
$wp_list_table = WPRC_Loader::getListTable('deleted-repositories');
//Handle bulk deletes
$doaction = $wp_list_table->current_action();
if ($doaction) {
    $repository_model = WPRC_Loader::getModel('repositories');
}
$url = admin_url() . 'admin.php?page=' . WPRC_PLUGIN_FOLDER . '/pages/deleted-repositories.php';
if ($doaction && isset($_REQUEST['checked'])) {
    check_admin_referer('bulk-list-deleted-repositories');
    if ('undelete' == $doaction) {
        $bulklinks = (array) $_REQUEST['checked'];
        foreach ($bulklinks as $id) {
            $repository_id = (int) $id;
            $repository_model->softundeleteRepository($repository_id);
        }
    }
} elseif ($doaction) {
    switch ($doaction) {
        case 'undelete':
            if (!isset($_REQUEST['id'])) {
                break;
Пример #3
0
 /**
  * Display search results
  */
 public function displaySearchResults()
 {
     $wp_list_table = WPRC_Loader::getListTable('theme-install');
     $pagenum = $wp_list_table->get_pagenum();
     $wp_list_table->prepare_items();
     $title = __('Install Themes');
     $parent_file = 'themes.php';
     if (!is_network_admin()) {
         $submenu_file = 'themes.php';
     }
     wp_enqueue_script('theme-install');
     add_thickbox();
     wp_enqueue_script('theme-preview');
     if (isset($tab)) {
         $body_id = $tab;
         do_action('install_themes_pre_' . $tab);
         //Used to override the general interface, Eg, install or theme information.
     }
     $help = '<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.', 'installer'), 'http://wordpress.org/extend/themes/') . '</p>';
     $help .= '<p>' . __('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter. Alternately, you can browse the themes that are Featured, Newest, or Recently Updated. When you find a theme you like, you can preview it or install it.', 'installer') . '</p>';
     $help .= '<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your <code>/wp-content/themes</code> directory.', 'installer') . '</p>';
     get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => $help));
     get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', 'installer') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>', 'installer') . '</p>' . '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>', 'installer') . '</p>');
     include ABSPATH . 'wp-admin/admin-header.php';
     $this->renderAdditionalSearchUI();
     echo '<div class="wrap">';
     screen_icon();
     if (is_network_admin()) {
         echo '<h2>' . esc_html($title) . '</h2>';
     } else {
         echo '<h2 class="nav-tab-wrapper"><a href="themes.php" class="nav-tab">' . esc_html_x('Manage Themes', 'theme') . '</a>
         <a href="theme-install.php" class="nav-tab nav-tab-active">' . esc_html($title) . '</a></h2>';
     }
     $wp_list_table->views();
     $wp_list_table->display();
     echo '<br class="clear" />';
     if (isset($tab) && isset($paged)) {
         do_action('install_themes_' . $tab, $paged);
     }
     echo '</div>';
     include ABSPATH . 'wp-admin/admin-footer.php';
     exit;
 }
Пример #4
0
 /**
  * Display search results
  */
 public function displaySearchResults()
 {
     //global $tab, $paged;
     if (!current_user_can('install_plugins')) {
         wp_die(__('You do not have sufficient permissions to install plugins on this site.', 'installer'));
     }
     if (is_multisite() && !is_network_admin()) {
         wp_redirect(network_admin_url('plugin-install.php'));
         exit;
     }
     $wp_list_table = WPRC_Loader::getListTable('plugin-install');
     $pagenum = $wp_list_table->get_pagenum();
     $wp_list_table->prepare_items();
     $title = __('Install Plugins', 'installer');
     $parent_file = 'plugins.php';
     wp_enqueue_script('plugin-install');
     if (isset($tab)) {
         if ('plugin-information' != $tab) {
             add_thickbox();
         }
         $body_id = $tab;
         do_action('install_plugins_pre_' . $tab);
         //Used to override the general interface, Eg, install or plugin information.
     }
     //get_current_screen()->add_help_tab( array(
     //'id'		=> 'overview',
     //'title'		=> __('Overview', 'installer'),
     //'content'	=>
     //	'<p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'http:wordpress.org/extend/plugins/') . '</p>'
     //) );
     //get_current_screen()->add_help_tab( array(
     //'id'		=> 'adding-plugins',
     //'title'		=> __('Adding Plugins', 'installer'),
     //'content'	=>
     //	'<p>' . __('If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting a popular tags. Tags in larger type mean more plugins have been labeled with that tag.', 'installer') . '</p>' .
     //	'<p>' . __('If you just want to get an idea of what&#8217;s available, you can browse Featured, Popular, Newest, and Recently Updated plugins by using the links in the upper left of the screen. These sections rotate regularly.', 'installer') . '</p>' .
     //	'<p>' . __('If you want to install a plugin that you&#8217;ve downloaded elsewhere, click the Upload in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.', 'installer') . '</p>'
     //) );
     //
     //get_current_screen()->set_help_sidebar(
     //	'<p><strong>' . __('For more information:', 'installer') . '</strong></p>' .
     //	'<p>' . __('<a href="http:codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>', 'installer') . '</p>' .
     //	'<p>' . __('<a href="http:wordpress.org/support/" target="_blank">Support Forums</a>', 'installer') . '</p>'
     //);
     include ABSPATH . 'wp-admin/admin-header.php';
     $this->renderAdditionalSearchUI();
     echo '<div class="wrap">';
     screen_icon();
     echo '<h2>' . esc_html($title) . '</h2>';
     $wp_list_table->views();
     $wp_list_table->display();
     echo '<br class="clear" />';
     if (isset($tab) && isset($paged)) {
         do_action('install_plugins_' . $tab, $paged);
     }
     echo '</div>';
     include ABSPATH . 'wp-admin/admin-footer.php';
     exit;
 }