function ultimatum_css_regen_thickbox() { iframe_header(); ultimatum_css_regenerator(); iframe_footer(); exit; }
/** * Load gmedia pages in wpless interface */ function gmedia_blank_page() { set_current_screen('GrandMedia_Settings'); global $gmCore; $gmediablank = $gmCore->_get('gmediablank', ''); /* add_filter('admin_body_class', function(){ $gmediablank = isset($_GET['gmediablank'])? $_GET['gmediablank'] : ''; return "gmedia-blank $gmediablank"; }); */ add_filter('admin_body_class', create_function('', '$gmediablank = isset($_GET["gmediablank"])? $_GET["gmediablank"] : ""; return "gmedia-blank $gmediablank";')); define('IFRAME_REQUEST', true); iframe_header('GmediaGallery'); switch ($gmediablank) { case 'update_plugin': require_once dirname(dirname(__FILE__)) . '/update.php'; gmedia_do_update(); break; case 'image_editor': require_once dirname(dirname(__FILE__)) . '/inc/image-editor.php'; gmedia_image_editor(); break; } iframe_footer(); exit; }
function ultimatum_mobile_assign_thickbox() { iframe_header(); ultimatum_mobile_assigner(); iframe_footer(); exit; }
/** * Sets up the move tickets dialog. */ public function dialog() { if (!$this->is_move_tickets_dialog()) { return; } if (!wp_verify_nonce($_GET['check'], 'move_tickets')) { return; } $event_id = isset($_GET['event_id']) ? absint($_GET['event_id']) : absint($_GET['post']); $attendee_ids = array_map('intval', explode('|', @$_GET['ticket_ids'])); $this->build_attendee_list($attendee_ids, $event_id); /** * Provides an opportunity to modify the template variables used in the * move tickets dialog. * * @param array $template_vars */ $template_vars = (array) apply_filters('tribe_tickets_move_tickets_template_vars', array('title' => __('Move Attendees', 'event-tickets'), 'mode' => 'move_tickets', 'check' => wp_create_nonce('move_tickets'), 'event_name' => get_the_title($event_id), 'attendees' => $this->attendees, 'multiple_providers' => $this->has_multiple_providers)); set_current_screen(); define('IFRAME_REQUEST', true); $this->dialog_assets(); iframe_header($template_vars['title']); extract($template_vars); include EVENT_TICKETS_DIR . '/src/admin-views/move-tickets.php'; iframe_footer(); exit; }
function ultimatum_export_thickbox() { iframe_header(); Ultimatum_Exporter(); iframe_footer(); exit; }
function ultimatum_layout_options_thickbox() { iframe_header(); ultimatum_layout_opts(); iframe_footer(); exit; }
function ultimatum_row_layouts_thickbox() { iframe_header(); ultimatum_row_selector(); iframe_footer(); exit; }
protected function header() { define('IFRAME_REQUEST', true); global $body_id; $body_id = $this->body_id; iframe_header($this->title); }
function tab_handler() { global $body_id; if (!$this->user_allowed()) { return; } $body_id = 'media-upload'; iframe_header(__('Add From Server', 'add-from-server')); $this->handle_imports(); $this->main_content(); iframe_footer(); }
public function iframe_intercept($current_screen) { if ($current_screen->base !== 'mailpoet_page_wysija_config') { return; } if (!isset($_GET['action']) || $_GET['action'] !== 'packager-switch') { return; } // Verify if it's has been created within the last 12 hours (nonce) if (wp_verify_nonce($_GET['_wpnonce'], $_GET['action']) !== 1) { return; } // Require the Updater classes include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $to = isset($_GET['stable']) && $_GET['stable'] ? 'stable' : 'beta'; add_filter('pre_site_transient_update_plugins', array($this, 'pre_site_transient_update_plugins')); $plugins = array(); // Check for the action, it might be upgrading or installing $action = 'upgrade'; if (isset($_GET['_mp_action']) && in_array($_GET['_mp_action'], array('upgrade', 'install'))) { $action = strtolower($_GET['_mp_action']); } foreach (self::$plugins as $k => $plugin) { if (is_plugin_active($plugin)) { $plugins[] = $plugin; } } // Ajust the Padding/margin of the iFrame define('IFRAME_REQUEST', true); echo "<div style='margin: 0 20px;'>"; // Thats how WordPress calls for an iFrame page wp_enqueue_script('jquery'); iframe_header(); if ($action === 'upgrade') { $upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url'))); $upgrader->bulk_upgrade($plugins); } elseif ($action === 'install') { // If the action is install, it will only happen if it's the Premium $upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin()); $result = $upgrader->install(self::get_url(self::$plugins[1], WYSIJA::is_beta(), 'zip')); } iframe_footer(); echo "</div>"; remove_filter('pre_site_transient_update_plugins', array($this, 'pre_site_transient_update_plugins')); $model_config = WYSIJA::get('config', 'model'); $model_config->save(array('beta_mode' => $to === 'stable' ? false : true)); set_site_transient('update_plugins', ''); exit; }
public function __construct() { parent::__construct(__('Plugin Information', 'sputnik')); $this->plugin = $_GET['info']; try { $account = Sputnik::get_account(); $this->api = Sputnik::get_plugin($this->plugin, $account->ID); } catch (Exception $e) { status_header(500); iframe_header(__('', 'sputnik')); echo $e->getMessage(); iframe_footer(); die; } }
protected function prepare() { try { $this->file = $_GET['upgrade']; $data = Sputnik::get_from_file($file); if ($data === null) { throw new Exception(__('Plugin not found', 'sputnik')); } $this->id = $data['Sputnik ID']; } catch (Exception $e) { status_header(500); iframe_header(__('Update Plugin', 'sputnik')); echo $e->getMessage(); iframe_footer(); die; } parent::prepare(); }
/** * Load gmedia pages in wpless interface */ function gmedia_blank_page() { set_current_screen('GrandMedia_Settings'); global $gmCore, $gmProcessor; $gmediablank = $gmCore->_get('gmediablank', ''); define('IFRAME_REQUEST', true); iframe_header('GmediaGallery'); echo '<div id="gmedia-container">'; switch ($gmediablank) { case 'update_plugin': require_once dirname(dirname(__FILE__)) . '/config/update.php'; gmedia_do_update(); break; case 'image_editor': require_once dirname(dirname(__FILE__)) . '/inc/image-editor.php'; gmedia_image_editor(); break; case 'map_editor': require_once dirname(dirname(__FILE__)) . '/inc/map-editor.php'; gmedia_map_editor(); break; case 'library': echo '<div id="gmedia_iframe_content">'; echo '<div id="gm-message">' . $gmCore->alert('success', $gmProcessor->msg) . $gmCore->alert('danger', $gmProcessor->error) . '</div>'; include GMEDIA_ABSPATH . 'admin/pages/library/library.php'; echo '</div>'; break; case 'comments': require_once dirname(__FILE__) . '/tpl/comments.php'; break; case 'module_preview': require_once dirname(__FILE__) . '/tpl/module-preview.php'; break; } echo '</div>'; iframe_footer(); exit; }
/** * Display theme information in dialog box form. * * @since 2.8.0 */ function install_theme_information() { //TODO: This function needs a LOT of UI work :) global $tab, $themes_allowedtags; $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')); 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.') . '</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.') . '</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 (is_object($update_themes) && isset($update_themes->response)) { foreach ((array) $update_themes->response as $theme_slug => $theme_info) { if ($theme_slug === $api->slug) { $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'), $api->author); ?> </p> <p><?php printf(__('Version: %s'), $api->version); ?> </p> <?php $buttons = '<a class="button" id="cancel" href="#" onclick="tb_close();return false;">' . __('Cancel') . '</a> '; switch ($type) { default: case 'install': if (current_user_can('install_themes')) { $buttons .= '<a class="button-primary" id="install" href="' . wp_nonce_url(self_admin_url('update.php?action=install-theme&theme=' . $api->slug), 'install-theme_' . $api->slug) . '" target="_parent">' . __('Install Now') . '</a>'; } break; case 'update_available': if (current_user_can('update_themes')) { $buttons .= '<a class="button-primary" id="install" href="' . wp_nonce_url(self_admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) . '" target="_parent">' . __('Install Update Now') . '</a>'; } break; case 'newer_installed': if (current_user_can('install_themes') || current_user_can('update_themes')) { ?> <p><?php printf(__('Newer version (%s) is installed.'), $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.'); ?> </p><?php } break; } ?> <br class="clear" /> </div> <p class="action-button"> <?php echo $buttons; ?> <br class="clear" /> </p> <?php iframe_footer(); exit; }
/** * Display theme information in dialog box form. * * @since 2.8.0 * * @global WP_Theme_Install_List_Table $wp_list_table */ function install_theme_information() { global $wp_list_table; $theme = themes_api('theme_information', array('slug' => wp_unslash($_REQUEST['theme']))); if (is_wp_error($theme)) { wp_die($theme); } iframe_header(__('Theme Install')); if (!isset($wp_list_table)) { $wp_list_table = _get_list_table('WP_Theme_Install_List_Table'); } $wp_list_table->theme_installer_single($theme); iframe_footer(); exit; }
function do_extension_custom_upgrade() { if (!current_user_can('update_themes')) { wp_die(__('You do not have sufficient permissions to update extensions for this site.', 'framework')); } check_admin_referer('bulk-update-themes'); if (isset($_GET['extensions'])) { $extensions = explode(',', stripslashes($_GET['extensions'])); } elseif (isset($_POST['checked'])) { $extensions = (array) $_POST['checked']; } else { $extensions = array(); } $extensions = array_map('urldecode', $extensions); require_once 'extension_upgrader.php'; $url = 'update.php?action=update-selected-extensions&extensions=' . urlencode(implode(',', $extensions)); $nonce = 'bulk-update-themes'; wp_enqueue_script('jquery'); iframe_header(); $upgrader = new Extension_Upgrader(new Bulk_Extension_Upgrader_Skin(compact('nonce', 'url'))); $upgrader->bulk_upgrade($extensions); iframe_footer(); }
/** * Display plugin information in dialog box form. * * @since 2.7.0 */ function install_plugin_information() { global $tab; $api = plugins_api('plugin_information', array('slug' => stripslashes($_REQUEST['plugin']))); if (is_wp_error($api)) { wp_die($api); } $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); //Sanitize HTML foreach ((array) $api->sections as $section_name => $content) { $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags); } foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) { $api->{$key} = wp_kses($api->{$key}, $plugins_allowedtags); } $section = isset($_REQUEST['section']) ? stripslashes($_REQUEST['section']) : 'description'; //Default to the Description tab, Do not translate, API returns English. if (empty($section) || !isset($api->sections[$section])) { $section = array_shift($section_titles = array_keys((array) $api->sections)); } iframe_header(__('Plugin Install')); echo "<div id='{$tab}-header'>\n"; echo "<ul id='sidemenu'>\n"; foreach ((array) $api->sections as $section_name => $content) { $title = $section_name; $title = ucwords(str_replace('_', ' ', $title)); $class = $section_name == $section ? ' class="current"' : ''; $href = add_query_arg(array('tab' => $tab, 'section' => $section_name)); $href = clean_url($href); $san_title = attribute_escape(sanitize_title_with_dashes($title)); echo "\t<li><a name='{$san_title}' target='' href='{$href}'{$class}>{$title}</a></li>\n"; } echo "</ul>\n"; echo "</div>\n"; ?> <div class="alignright fyi"> <?php if (!empty($api->download_link)) { ?> <p class="action-button"> <?php //Default to a "new" plugin $type = 'install'; //Check to see if this plugin is known to be installed, and has an update awaiting it. $update_plugins = get_option('update_plugins'); foreach ((array) $update_plugins->response as $file => $plugin) { if ($plugin->slug === $api->slug) { $type = 'update_available'; $update_file = $file; break; } } if ('install' == $type && is_dir(WP_PLUGIN_DIR . '/' . $api->slug)) { $installed_plugin = get_plugins('/' . $api->slug); if (!empty($installed_plugin)) { $key = array_shift($key = array_keys($installed_plugin)); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers if (version_compare($api->version, $installed_plugin[$key]['Version'], '>')) { $type = 'latest_installed'; } elseif (version_compare($api->version, $installed_plugin[$key]['Version'], '<')) { $type = 'newer_installed'; $newer_version = $installed_plugin[$key]['Version']; } else { //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh delete_option('update_plugins'); $update_file = $api->slug . '/' . $key; //This code branch only deals with a plugin which is in a folder the same name as its slug, Doesnt support plugins which have 'non-standard' names $type = 'update_available'; } } } switch ($type) { default: case 'install': if (current_user_can('install_plugins')) { ?> <a href="<?php echo wp_nonce_url(admin_url('plugin-install.php?tab=install&plugin=' . $api->slug), 'install-plugin_' . $api->slug); ?> " target="_parent"><?php _e('Install Now'); ?> </a><?php } break; case 'update_available': if (current_user_can('update_plugins')) { ?> <a href="<?php echo wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file); ?> " target="_parent"><?php _e('Install Update Now'); ?> </a><?php } break; case 'newer_installed': if (current_user_can('install_plugins') || current_user_can('update_plugins')) { ?> <a><?php printf(__('Newer Version (%s) Installed'), $newer_version); ?> </a><?php } break; case 'latest_installed': if (current_user_can('install_plugins') || current_user_can('update_plugins')) { ?> <a><?php _e('Latest Version Installed'); ?> </a><?php } break; } ?> </p> <?php } ?> <h2 class="mainheader"><?php _e('FYI'); ?> </h2> <ul> <?php if (!empty($api->version)) { ?> <li><strong><?php _e('Version:'); ?> </strong> <?php echo $api->version; ?> </li> <?php } if (!empty($api->author)) { ?> <li><strong><?php _e('Author:'); ?> </strong> <?php echo links_add_target($api->author, '_blank'); ?> </li> <?php } if (!empty($api->last_updated)) { ?> <li><strong><?php _e('Last Updated:'); ?> </strong> <span title="<?php echo $api->last_updated; ?> "><?php printf(__('%s ago'), human_time_diff(strtotime($api->last_updated))); ?> </span></li> <?php } if (!empty($api->requires)) { ?> <li><strong><?php _e('Requires WordPress Version:'); ?> </strong> <?php printf(__('%s or higher'), $api->requires); ?> </li> <?php } if (!empty($api->tested)) { ?> <li><strong><?php _e('Compatible up to:'); ?> </strong> <?php echo $api->tested; ?> </li> <?php } if (!empty($api->downloaded)) { ?> <li><strong><?php _e('Downloaded:'); ?> </strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)); ?> </li> <?php } if (!empty($api->slug)) { ?> <li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug; ?> /"><?php _e('WordPress.org Plugin Page »'); ?> </a></li> <?php } if (!empty($api->homepage)) { ?> <li><a target="_blank" href="<?php echo $api->homepage; ?> "><?php _e('Plugin Homepage »'); ?> </a></li> <?php } ?> </ul> <h2><?php _e('Average Rating'); ?> </h2> <div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?> "> <div class="star star-rating" style="width: <?php echo attribute_escape($api->rating); ?> px"></div> <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?> " alt="<?php _e('5 stars'); ?> " /></div> <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?> " alt="<?php _e('4 stars'); ?> " /></div> <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?> " alt="<?php _e('3 stars'); ?> " /></div> <div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?> " alt="<?php _e('2 stars'); ?> " /></div> <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?> " alt="<?php _e('1 star'); ?> " /></div> </div> <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?> </small> </div> <div id="section-holder" class="wrap"> <?php if (!empty($api->tested) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>')) { echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>'; } else { if (!empty($api->requires) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<')) { echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>'; } } foreach ((array) $api->sections as $section_name => $content) { $title = $section_name; $title[0] = strtoupper($title[0]); $title = str_replace('_', ' ', $title); $content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/'); $content = links_add_target($content, '_blank'); $san_title = attribute_escape(sanitize_title_with_dashes($title)); $display = $section_name == $section ? 'block' : 'none'; echo "\t<div id='section-{$san_title}' class='section' style='display: {$display};'>\n"; echo "\t\t<h2 class='long-header'>{$title}</h2>"; echo $content; echo "\t</div>\n"; } echo "</div>\n"; iframe_footer(); exit; }
function tab_handler() { if (!$this->user_allowed()) { return; } //Set the body ID $GLOBALS['body_id'] = 'media-upload'; //Do an IFrame header iframe_header(__('Add From Server', 'add-from-server')); //Add the Media buttons media_upload_header(); //Handle any imports: $this->handle_imports(); //Do the content $this->main_content(); //Do a footer iframe_footer(); }
/** * Display theme information in dialog box form. * * @since 2.8.0 */ function install_theme_information() { global $tab, $themes_allowedtags, $wp_list_table; $theme = themes_api('theme_information', array('slug' => wp_unslash($_REQUEST['theme']))); if (is_wp_error($theme)) { wp_die($theme); } iframe_header(__('Theme Install')); $wp_list_table->theme_installer_single($theme); iframe_footer(); exit; }
/** * Display plugin information in dialog box form. * * @since 2.7.0 */ function fs_install_plugin_information() { global $tab; if (empty($_REQUEST['plugin'])) { return; } $args = array('slug' => wp_unslash($_REQUEST['plugin']), 'is_ssl' => is_ssl(), 'fields' => array('banners' => true, 'reviews' => true)); if (is_array($args)) { $args = (object) $args; } if (!isset($args->per_page)) { $args->per_page = 24; } if (!isset($args->locale)) { $args->locale = get_locale(); } $api = apply_filters('fs_plugins_api', false, 'plugin_information', $args); if (is_wp_error($api)) { wp_die($api); } $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array(), 'class' => array()), 'style' => array(), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array('class' => array()), 'span' => array('class' => array()), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array('class' => array()), 'i' => array('class' => array()), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); $plugins_section_titles = array('description' => _x('Description', 'Plugin installer section title'), 'installation' => _x('Installation', 'Plugin installer section title'), 'faq' => _x('FAQ', 'Plugin installer section title'), 'screenshots' => _x('Screenshots', 'Plugin installer section title'), 'changelog' => _x('Changelog', 'Plugin installer section title'), 'reviews' => _x('Reviews', 'Plugin installer section title'), 'other_notes' => _x('Other Notes', 'Plugin installer section title')); // Sanitize HTML // foreach ( (array) $api->sections as $section_name => $content ) { // $api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags ); // } foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) { if (isset($api->{$key})) { $api->{$key} = wp_kses($api->{$key}, $plugins_allowedtags); } } // Add after $api->slug is ready. $plugins_section_titles['features'] = __fs('features-and-pricing', $api->slug); $_tab = esc_attr($tab); $section = isset($_REQUEST['section']) ? wp_unslash($_REQUEST['section']) : 'description'; // Default to the Description tab, Do not translate, API returns English. if (empty($section) || !isset($api->sections[$section])) { $section_titles = array_keys((array) $api->sections); $section = array_shift($section_titles); } iframe_header(__('Plugin Install')); $_with_banner = ''; // var_dump($api->banners); if (!empty($api->banners) && (!empty($api->banners['low']) || !empty($api->banners['high']))) { $_with_banner = 'with-banner'; $low = empty($api->banners['low']) ? $api->banners['high'] : $api->banners['low']; $high = empty($api->banners['high']) ? $api->banners['low'] : $api->banners['high']; ?> <style type="text/css"> #plugin-information-title.with-banner { background-image: url( <?php echo esc_url($low); ?> ); } @media only screen and ( -webkit-min-device-pixel-ratio: 1.5 ) { #plugin-information-title.with-banner { background-image: url( <?php echo esc_url($high); ?> ); } } </style> <?php } echo '<div id="plugin-information-scrollable">'; echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>"; echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n"; foreach ((array) $api->sections as $section_name => $content) { if ('reviews' === $section_name && (empty($api->ratings) || 0 === array_sum((array) $api->ratings))) { continue; } if (isset($plugins_section_titles[$section_name])) { $title = $plugins_section_titles[$section_name]; } else { $title = ucwords(str_replace('_', ' ', $section_name)); } $class = $section_name === $section ? ' class="current"' : ''; $href = add_query_arg(array('tab' => $tab, 'section' => $section_name)); $href = esc_url($href); $san_section = esc_attr($section_name); echo "\t<a name='{$san_section}' href='{$href}' {$class}>{$title}</a>\n"; } echo "</div>\n"; ?> <div id="<?php echo $_tab; ?> -content" class='<?php echo $_with_banner; ?> '> <div class="fyi"> <?php if (isset($api->plans)) { ?> <div class="plugin-information-pricing"> <?php foreach ($api->plans as $plan) { ?> <h3 data-plan="<?php echo $plan->id; ?> "><?php printf(__fs('x-plan', $api->slug), $plan->title); ?> </h3> <ul> <?php $billing_cycle = 'annual'; ?> <?php if (1 === count($plan->pricing) && 1 == $plan->pricing[0]->licenses) { ?> <?php $pricing = $plan->pricing[0]; ?> <li><label><?php _efs('price', $api->slug); ?> : $<?php if (isset($pricing->annual_price)) { echo $pricing->annual_price . ($plan->is_block_features ? ' / year' : ''); $billing_cycle = 'annual'; } else { if (isset($pricing->monthly_price)) { echo $pricing->monthly_price . ' / mo'; $billing_cycle = 'monthly'; } else { if (isset($pricing->lifetime_price)) { echo $pricing->lifetime_price; $billing_cycle = 'lifetime'; } } } ?> </label></li> <?php } else { ?> <?php $first = true; foreach ($plan->pricing as $pricing) { ?> <li><label><input name="pricing-<?php echo $plan->id; ?> " type="radio" value="<?php echo $pricing->id; ?> "<?php checked($first, true); ?> ><?php switch ($pricing->licenses) { case '1': _efs('license-single-site', $api->slug); break; case null: _efs('license-unlimited', $api->slug); break; default: printf(__fs('license-x-sites', $api->slug), $pricing->licenses); break; } ?> - $<?php if (isset($pricing->annual_price)) { echo $pricing->annual_price . ($plan->is_block_features ? ' / year' : ''); $billing_cycle = 'annual'; } else { if (isset($pricing->monthly_price)) { echo $pricing->monthly_price . ' / mo'; $billing_cycle = 'monthly'; } else { if (isset($pricing->lifetime_price)) { echo $pricing->lifetime_price; $billing_cycle = 'lifetime'; } } } ?> </label></li> <?php $first = false; } ?> <?php } ?> </ul> <?php echo ' <a class="button button-primary right" href="' . esc_url(add_query_arg(array('plugin_id' => $plan->plugin_id, 'plan_id' => $plan->id, 'pricing_id' => $plan->pricing[0]->id, 'billing_cycle' => $billing_cycle), $api->checkout_link)) . '" target="_parent">' . __fs('purchase', $api->slug) . '</a>'; ?> </div> <?php } ?> <?php wp_enqueue_script('jquery'); ?> <script type="text/javascript"> (function ($) { $('.plugin-information-pricing input[type=radio]').click(function () { var checkout_url = '<?php echo esc_url_raw(add_query_arg(array('plugin_id' => $plan->plugin_id, 'billing_cycle' => $billing_cycle), $api->checkout_link)); ?> &plan_id=' + $(this).parents('.plugin-information-pricing').find('h3').attr('data-plan') + '&pricing_id=' + $(this).val(); $('.plugin-information-pricing .button, #plugin-information-footer .button').attr('href', checkout_url); }); })(jQuery); </script> <?php } ?> <div> <h3><?php _efs('details', $api->slug); ?> </h3> <ul> <?php if (!empty($api->version)) { ?> <li><strong><?php _e('Version:'); ?> </strong> <?php echo $api->version; ?> </li> <?php } if (!empty($api->author)) { ?> <li> <strong><?php _e('Author:'); ?> </strong> <?php echo links_add_target($api->author, '_blank'); ?> </li> <?php } if (!empty($api->last_updated)) { ?> <li><strong><?php _e('Last Updated:'); ?> </strong> <span title="<?php echo $api->last_updated; ?> "> <?php printf(__('%s ago'), human_time_diff(strtotime($api->last_updated))); ?> </span></li> <?php } if (!empty($api->requires)) { ?> <li> <strong><?php _e('Requires WordPress Version:'); ?> </strong> <?php printf(__('%s or higher'), $api->requires); ?> </li> <?php } if (!empty($api->tested)) { ?> <li><strong><?php _e('Compatible up to:'); ?> </strong> <?php echo $api->tested; ?> </li> <?php } if (!empty($api->downloaded)) { ?> <li> <strong><?php _e('Downloaded:'); ?> </strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)); ?> </li> <?php } if (!empty($api->slug) && empty($api->external)) { ?> <li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug; ?> /"><?php _e('WordPress.org Plugin Page »'); ?> </a> </li> <?php } if (!empty($api->homepage)) { ?> <li><a target="_blank" href="<?php echo esc_url($api->homepage); ?> "><?php _e('Plugin Homepage »'); ?> </a> </li> <?php } if (!empty($api->donate_link) && empty($api->contributors)) { ?> <li><a target="_blank" href="<?php echo esc_url($api->donate_link); ?> "><?php _e('Donate to this plugin »'); ?> </a> </li> <?php } ?> </ul> </div> <?php if (!empty($api->rating)) { ?> <h3><?php _e('Average Rating'); ?> </h3> <?php wp_star_rating(array('rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings)); ?> <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?> </small> <?php } if (!empty($api->ratings) && array_sum((array) $api->ratings) > 0) { foreach ($api->ratings as $key => $ratecount) { // Avoid div-by-zero. $_rating = $api->num_ratings ? $ratecount / $api->num_ratings : 0; ?> <div class="counter-container"> <span class="counter-label"><a href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?> ?filter=<?php echo $key; ?> " target="_blank" title="<?php echo esc_attr(sprintf(_n('Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key), $key)); ?> "><?php printf(_n('%d star', '%d stars', $key), $key); ?> </a></span> <span class="counter-back"> <span class="counter-bar" style="width: <?php echo 92 * $_rating; ?> px;"></span> </span> <span class="counter-count"><?php echo number_format_i18n($ratecount); ?> </span> </div> <?php } } if (!empty($api->contributors)) { ?> <h3><?php _e('Contributors'); ?> </h3> <ul class="contributors"> <?php foreach ((array) $api->contributors as $contrib_username => $contrib_profile) { if (empty($contrib_username) && empty($contrib_profile)) { continue; } if (empty($contrib_username)) { $contrib_username = preg_replace('/^.+\\/(.+)\\/?$/', '\\1', $contrib_profile); } $contrib_username = sanitize_user($contrib_username); if (empty($contrib_profile)) { echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>"; } else { echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</a></li>"; } } ?> </ul> <?php if (!empty($api->donate_link)) { ?> <a target="_blank" href="<?php echo esc_url($api->donate_link); ?> "><?php _e('Donate to this plugin »'); ?> </a> <?php } ?> <?php } ?> </div> <div id="section-holder" class="wrap"> <?php if (!empty($api->tested) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>')) { echo '<div class="notice notice-warning"><p>' . '<strong>' . __('Warning:') . '</strong> ' . __('This plugin has not been tested with your current version of WordPress.') . '</p></div>'; } else { if (!empty($api->requires) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<')) { echo '<div class="notice notice-warning"><p>' . '<strong>' . __('Warning:') . '</strong> ' . __('This plugin has not been marked as compatible with your version of WordPress.') . '</p></div>'; } } foreach ((array) $api->sections as $section_name => $content) { $content = links_add_base_url($content, 'https://wordpress.org/plugins/' . $api->slug . '/'); $content = links_add_target($content, '_blank'); $san_section = esc_attr($section_name); $display = $section_name === $section ? 'block' : 'none'; echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n"; echo $content; echo "\t</div>\n"; } echo "</div>\n"; echo "</div>\n"; echo "</div>\n"; // #plugin-information-scrollable echo "<div id='{$tab}-footer'>\n"; if (current_user_can('install_plugins') || current_user_can('update_plugins')) { if (!empty($api->checkout_link) && isset($api->plans) && 0 < is_array($api->plans)) { echo ' <a class="button button-primary right" href="' . esc_url(add_query_arg(array('plugin_id' => $plan->plugin_id, 'plan_id' => $plan->id, 'pricing_id' => $plan->pricing[0]->id, 'billing_cycle' => $billing_cycle), $api->checkout_link)) . '" target="_parent">' . __fs('purchase', $api->slug) . '</a>'; // @todo Add Cart concept. // echo ' <a class="button right" href="' . $status['url'] . '" target="_parent">' . __( 'Add to Cart' ) . '</a>'; } else { if (!empty($api->download_link)) { $status = install_plugin_install_status($api); switch ($status['status']) { case 'install': if ($status['url']) { echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>'; } break; case 'update_available': if ($status['url']) { echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') . '</a>'; } break; case 'newer_installed': echo '<a class="button button-primary right disabled">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>'; break; case 'latest_installed': echo '<a class="button button-primary right disabled">' . __('Latest Version Installed') . '</a>'; break; } } } } echo "</div>\n"; iframe_footer(); exit; }
$url = 'update.php?action=upgrade-plugin&plugin=' . $plugin; $upgrader = new Plugin_Upgrader(new Plugin_Upgrader_Skin(compact('title', 'nonce', 'url', 'plugin'))); $upgrader->upgrade($plugin); include 'admin-footer.php'; } elseif ('activate-plugin' == $action) { if (!current_user_can('update_plugins')) { wp_die(__('You do not have sufficient permissions to update plugins for this blog.')); } check_admin_referer('activate-plugin_' . $plugin); if (!isset($_GET['failure']) && !isset($_GET['success'])) { wp_redirect('update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce']); activate_plugin($plugin); wp_redirect('update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce']); die; } iframe_header(__('Plugin Reactivation'), true); if (isset($_GET['success'])) { echo '<p>' . __('Plugin reactivated successfully.') . '</p>'; } if (isset($_GET['failure'])) { echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>'; if (defined('E_RECOVERABLE_ERROR')) { error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); } else { error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING); } @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. include WP_PLUGIN_DIR . '/' . $plugin; } iframe_footer();
/** * Display plugin information in dialog box form. * * @since 2.7.0 */ function install_plugin_information() { global $tab; $api = plugins_api('plugin_information', array('slug' => wp_unslash($_REQUEST['plugin']))); if (is_wp_error($api)) { wp_die($api); } $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); $plugins_section_titles = array('description' => _x('Description', 'Plugin installer section title'), 'installation' => _x('Installation', 'Plugin installer section title'), 'faq' => _x('FAQ', 'Plugin installer section title'), 'screenshots' => _x('Screenshots', 'Plugin installer section title'), 'changelog' => _x('Changelog', 'Plugin installer section title'), 'other_notes' => _x('Other Notes', 'Plugin installer section title')); //Sanitize HTML foreach ((array) $api->sections as $section_name => $content) { $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags); } foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) { if (isset($api->{$key})) { $api->{$key} = wp_kses($api->{$key}, $plugins_allowedtags); } } $section = isset($_REQUEST['section']) ? wp_unslash($_REQUEST['section']) : 'description'; //Default to the Description tab, Do not translate, API returns English. if (empty($section) || !isset($api->sections[$section])) { $section = array_shift($section_titles = array_keys((array) $api->sections)); } iframe_header(__('Plugin Install')); echo "<div id='{$tab}-header'>\n"; echo "<ul id='sidemenu'>\n"; foreach ((array) $api->sections as $section_name => $content) { if (isset($plugins_section_titles[$section_name])) { $title = $plugins_section_titles[$section_name]; } else { $title = ucwords(str_replace('_', ' ', $section_name)); } $class = $section_name == $section ? ' class="current"' : ''; $href = add_query_arg(array('tab' => $tab, 'section' => $section_name)); $href = esc_url($href); $san_section = esc_attr($section_name); echo "\t<li><a name='{$san_section}' href='{$href}' {$class}>{$title}</a></li>\n"; } echo "</ul>\n"; echo "</div>\n"; ?> <div class="alignright fyi"> <?php if (!empty($api->download_link) && (current_user_can('install_plugins') || current_user_can('update_plugins'))) { ?> <p class="action-button"> <?php $status = install_plugin_install_status($api); switch ($status['status']) { case 'install': if ($status['url']) { echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>'; } break; case 'update_available': if ($status['url']) { echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') . '</a>'; } break; case 'newer_installed': echo '<a>' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>'; break; case 'latest_installed': echo '<a>' . __('Latest Version Installed') . '</a>'; break; } ?> </p> <?php } ?> <h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI'); ?> </h2> <ul> <?php if (!empty($api->version)) { ?> <li><strong><?php _e('Version:'); ?> </strong> <?php echo $api->version; ?> </li> <?php } if (!empty($api->author)) { ?> <li><strong><?php _e('Author:'); ?> </strong> <?php echo links_add_target($api->author, '_blank'); ?> </li> <?php } if (!empty($api->last_updated)) { ?> <li><strong><?php _e('Last Updated:'); ?> </strong> <span title="<?php echo $api->last_updated; ?> "><?php printf(__('%s ago'), human_time_diff(strtotime($api->last_updated))); ?> </span></li> <?php } if (!empty($api->requires)) { ?> <li><strong><?php _e('Requires WordPress Version:'); ?> </strong> <?php printf(__('%s or higher'), $api->requires); ?> </li> <?php } if (!empty($api->tested)) { ?> <li><strong><?php _e('Compatible up to:'); ?> </strong> <?php echo $api->tested; ?> </li> <?php } if (!empty($api->downloaded)) { ?> <li><strong><?php _e('Downloaded:'); ?> </strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)); ?> </li> <?php } if (!empty($api->slug) && empty($api->external)) { ?> <li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug; ?> /"><?php _e('WordPress.org Plugin Page »'); ?> </a></li> <?php } if (!empty($api->homepage)) { ?> <li><a target="_blank" href="<?php echo $api->homepage; ?> "><?php _e('Plugin Homepage »'); ?> </a></li> <?php } ?> </ul> <?php if (!empty($api->rating)) { ?> <h2><?php _e('Average Rating'); ?> </h2> <div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?> "> <div class="star star-rating" style="width: <?php echo esc_attr(str_replace(',', '.', $api->rating)); ?> px"></div> </div> <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?> </small> <?php } ?> </div> <div id="section-holder" class="wrap"> <?php if (!empty($api->tested) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>')) { echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>'; } else { if (!empty($api->requires) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<')) { echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>'; } } foreach ((array) $api->sections as $section_name => $content) { if (isset($plugins_section_titles[$section_name])) { $title = $plugins_section_titles[$section_name]; } else { $title = ucwords(str_replace('_', ' ', $section_name)); } $content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/'); $content = links_add_target($content, '_blank'); $san_section = esc_attr($section_name); $display = $section_name == $section ? 'block' : 'none'; echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n"; echo "\t\t<h2 class='long-header'>{$title}</h2>"; echo $content; echo "\t</div>\n"; } echo "</div>\n"; iframe_footer(); exit; }
protected static function upgrade($file) { include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; try { $data = Sputnik::get_from_file($file); if ($data === null) { throw new Exception(__('Plugin not found', 'wpsc')); } $id = $data['Sputnik ID']; $api = Sputnik::get_plugin($id); } catch (Exception $e) { status_header(500); iframe_header(__('Update Plugin', 'wpsc')); echo $e->getMessage(); iframe_footer(); die; } if (!Sputnik::is_purchased($id)) { wp_redirect(self::build_url(array('buy' => $id))); die; } if (!current_user_can('install_plugins')) { wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'wpsc')); } include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; check_admin_referer('sputnik_upgrade-plugin_' . $file); global $body_id; $body_id = 'sputnik-upgrade'; iframe_header(__('Update Plugin', 'wpsc')); $title = sprintf(__('Updating Plugin: %s', 'wpsc'), $api->name . ' ' . $api->version); $nonce = 'sputnik_upgrade-plugin_' . $id; $url = 'update.php?action=upgrade-plugin&plugin=' . $id; if (isset($_GET['from'])) { $url .= '&from=' . urlencode(stripslashes($_GET['from'])); } $type = 'web'; //Install plugin type, From Web or an Upload. $plugin = $id; if ($api->is_theme) { $upgrader = new Sputnik_ThemeUpgrader(new Sputnik_Upgrader_Skin(compact('title', 'url', 'nonce', 'plugin', 'api'))); } else { $upgrader = new Sputnik_Upgrader(new Sputnik_Upgrader_Skin(compact('title', 'url', 'nonce', 'plugin', 'api'))); } $upgrader->upgrade($file); iframe_footer(); die; }
/** * Display plugin information in dialog box form. * * Based on core install_plugin_information() function. * * @author Vova Feldman (@svovaf) * @since 1.0.6 */ function install_plugin_information() { global $tab; if (empty($_REQUEST['plugin'])) { return; } $args = array('slug' => wp_unslash($_REQUEST['plugin']), 'is_ssl' => is_ssl(), 'fields' => array('banners' => true, 'reviews' => true, 'downloaded' => false, 'active_installs' => true)); if (is_array($args)) { $args = (object) $args; } if (!isset($args->per_page)) { $args->per_page = 24; } if (!isset($args->locale)) { $args->locale = get_locale(); } $api = apply_filters('fs_plugins_api', false, 'plugin_information', $args); if (is_wp_error($api)) { wp_die($api); } $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array(), 'class' => array()), 'style' => array(), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array('class' => array()), 'span' => array('class' => array()), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array('class' => array()), 'i' => array('class' => array()), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); $plugins_section_titles = array('description' => _x('Description', 'Plugin installer section title'), 'installation' => _x('Installation', 'Plugin installer section title'), 'faq' => _x('FAQ', 'Plugin installer section title'), 'screenshots' => _x('Screenshots', 'Plugin installer section title'), 'changelog' => _x('Changelog', 'Plugin installer section title'), 'reviews' => _x('Reviews', 'Plugin installer section title'), 'other_notes' => _x('Other Notes', 'Plugin installer section title')); // Sanitize HTML // foreach ( (array) $api->sections as $section_name => $content ) { // $api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags ); // } foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) { if (isset($api->{$key})) { $api->{$key} = wp_kses($api->{$key}, $plugins_allowedtags); } } // Add after $api->slug is ready. $plugins_section_titles['features'] = __fs('features-and-pricing', $api->slug); $_tab = esc_attr($tab); $section = isset($_REQUEST['section']) ? wp_unslash($_REQUEST['section']) : 'description'; // Default to the Description tab, Do not translate, API returns English. if (empty($section) || !isset($api->sections[$section])) { $section_titles = array_keys((array) $api->sections); $section = array_shift($section_titles); } iframe_header(__('Plugin Install')); $_with_banner = ''; // var_dump($api->banners); if (!empty($api->banners) && (!empty($api->banners['low']) || !empty($api->banners['high']))) { $_with_banner = 'with-banner'; $low = empty($api->banners['low']) ? $api->banners['high'] : $api->banners['low']; $high = empty($api->banners['high']) ? $api->banners['low'] : $api->banners['high']; ?> <style type="text/css"> #plugin-information-title.with-banner { background-image: url( <?php echo esc_url($low); ?> ); } @media only screen and ( -webkit-min-device-pixel-ratio: 1.5 ) { #plugin-information-title.with-banner { background-image: url( <?php echo esc_url($high); ?> ); } } </style> <?php } echo '<div id="plugin-information-scrollable">'; echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>"; echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n"; foreach ((array) $api->sections as $section_name => $content) { if ('reviews' === $section_name && (empty($api->ratings) || 0 === array_sum((array) $api->ratings))) { continue; } if (isset($plugins_section_titles[$section_name])) { $title = $plugins_section_titles[$section_name]; } else { $title = ucwords(str_replace('_', ' ', $section_name)); } $class = $section_name === $section ? ' class="current"' : ''; $href = add_query_arg(array('tab' => $tab, 'section' => $section_name)); $href = esc_url($href); $san_section = esc_attr($section_name); echo "\t<a name='{$san_section}' href='{$href}' {$class}>{$title}</a>\n"; } echo "</div>\n"; ?> <div id="<?php echo $_tab; ?> -content" class='<?php echo $_with_banner; ?> '> <div class="fyi"> <?php if ($api->is_paid) { ?> <?php if (isset($api->plans)) { ?> <div class="plugin-information-pricing"> <?php foreach ($api->plans as $plan) { ?> <?php /** * @var FS_Plugin_Plan $plan */ ?> <?php $first_pricing = $plan->pricing[0]; ?> <?php $is_multi_cycle = $first_pricing->is_multi_cycle(); ?> <div class="fs-plan<?php if (!$is_multi_cycle) { echo ' fs-single-cycle'; } ?> " data-plan-id="<?php echo $plan->id; ?> "> <h3 data-plan="<?php echo $plan->id; ?> "><?php printf(__fs('x-plan', $api->slug), $plan->title); ?> </h3> <?php $has_annual = $first_pricing->has_annual(); ?> <?php $has_monthly = $first_pricing->has_monthly(); ?> <div class="nav-tab-wrapper"> <?php $billing_cycles = array('monthly', 'annual', 'lifetime'); ?> <?php $i = 0; foreach ($billing_cycles as $cycle) { ?> <?php $prop = "{$cycle}_price"; if (isset($first_pricing->{$prop})) { ?> <?php $is_featured = 'annual' === $cycle && $is_multi_cycle; ?> <?php $prices = array(); foreach ($plan->pricing as $pricing) { if (isset($pricing->{$prop})) { $prices[] = array('id' => $pricing->id, 'licenses' => $pricing->licenses, 'price' => $pricing->{$prop}); } } ?> <a class="nav-tab" data-billing-cycle="<?php echo $cycle; ?> " data-pricing="<?php esc_attr_e(json_encode($prices)); ?> "> <?php if ($is_featured) { ?> <label>★ <?php _efs('best', $api->slug); ?> ★</label> <?php } ?> <?php _efs($cycle, $api->slug); ?> </a> <?php } ?> <?php $i++; } ?> <?php wp_enqueue_script('jquery'); ?> <script type="text/javascript"> (function ($, undef) { var _formatBillingFrequency = function (cycle) { switch (cycle) { case 'monthly': return '<?php printf(__fs('billed-x', $api->slug), __fs('monthly', $api->slug)); ?> '; case 'annual': return '<?php printf(__fs('billed-x', $api->slug), __fs('annually', $api->slug)); ?> '; case 'lifetime': return '<?php printf(__fs('billed-x', $api->slug), __fs('once', $api->slug)); ?> '; } }, _formatLicensesTitle = function (pricing) { switch (pricing.licenses) { case 1: return '<?php _efs('license-single-site', $api->slug); ?> '; case null: return '<?php _efs('license-unlimited', $api->slug); ?> '; default: return '<?php _efs('license-x-sites', $api->slug); ?> '.replace('%s', pricing.licenses); } }, _formatPrice = function (pricing, cycle, multipleLicenses) { if (undef === multipleLicenses) multipleLicenses = true; var priceCycle; switch (cycle) { case 'monthly': priceCycle = ' / <?php _efs('mo', $api->slug); ?> '; break; case 'lifetime': priceCycle = ''; break; case 'annual': default: priceCycle = ' / <?php _efs('year', $api->slug); ?> '; break; } if (!multipleLicenses && 1 == pricing.licenses) { return '$' + pricing.price + priceCycle; } return _formatLicensesTitle(pricing) + ' - <var class="fs-price">$' + pricing.price + priceCycle + '</var>'; }, _checkoutUrl = function (plan, pricing, cycle) { return '<?php echo esc_url_raw(remove_query_arg('billing_cycle', add_query_arg(array('plugin_id' => $plan->plugin_id), $api->checkout_link))); ?> ' + '&plan_id=' + plan + '&pricing_id=' + pricing + '&billing_cycle=' + cycle<?php if ($plan->has_trial()) { echo " + '&trial=true'"; } ?> ; }, _updateCtaUrl = function (plan, pricing, cycle) { $('.plugin-information-pricing .button, #plugin-information-footer .button').attr('href', _checkoutUrl(plan, pricing, cycle)); }; $(document).ready(function () { var $plan = $('.plugin-information-pricing .fs-plan[data-plan-id=<?php echo $plan->id; ?> ]'); $plan.find('input[type=radio]').live('click', function () { _updateCtaUrl( $plan.attr('data-plan-id'), $(this).val(), $plan.find('.nav-tab-active').attr('data-billing-cycle') ); $plan.find('.fs-trial-terms .fs-price').html( $(this).parents('label').find('.fs-price').html() ); }); $plan.find('.nav-tab').click(function () { if ($(this).hasClass('nav-tab-active')) return; var $this = $(this), billingCycle = $this.attr('data-billing-cycle'), pricing = JSON.parse($this.attr('data-pricing')), $pricesList = $this.parents('.fs-plan').find('.fs-pricing-body .fs-licenses'), html = ''; // Un-select previously selected tab. $plan.find('.nav-tab').removeClass('nav-tab-active'); // Select current tab. $this.addClass('nav-tab-active'); // Render licenses prices. if (1 == pricing.length) { html = '<li><label><?php _efs('price', $api->slug); ?> : ' + _formatPrice(pricing[0], billingCycle, false) + '</label></li>'; } else { for (var i = 0; i < pricing.length; i++) { html += '<li><label><input name="pricing-<?php echo $plan->id; ?> " type="radio" value="' + pricing[i].id + '">' + _formatPrice(pricing[i], billingCycle) + '</label></li>'; } } $pricesList.html(html); if (1 < pricing.length) { // Select first license option. $pricesList.find('li:first input').click(); } else { _updateCtaUrl( $plan.attr('data-plan-id'), pricing[0].id, billingCycle ); } // Update billing frequency. $plan.find('.fs-billing-frequency').html(_formatBillingFrequency(billingCycle)); if ('annual' === billingCycle) { $plan.find('.fs-annual-discount').show(); } else { $plan.find('.fs-annual-discount').hide(); } }); <?php if ($has_annual) { ?> // Select annual by default. $plan.find('.nav-tab[data-billing-cycle=annual]').click(); <?php } else { ?> // Select first tab. $plan.find('.nav-tab:first').click(); <?php } ?> }); }(jQuery)); </script> </div> <div class="fs-pricing-body"> <span class="fs-billing-frequency"></span> <?php $annual_discount = $has_annual && $has_monthly ? $plan->pricing[0]->annual_discount_percentage() : 0; ?> <?php if ($annual_discount > 0) { ?> <span class="fs-annual-discount"><?php printf(__fs('save-x', $api->slug), $annual_discount . '%'); ?> </span> <?php } ?> <ul class="fs-licenses"> </ul> <?php echo $this->get_plugin_cta($api, $plan); ?> <div style="clear:both"></div> <?php if ($plan->has_trial()) { ?> <?php $trial_period = $this->get_trial_period($plan); ?> <ul class="fs-trial-terms"> <li> <i class="dashicons dashicons-yes"></i><?php printf(__fs('no-commitment-x', $api->slug), $trial_period); ?> </li> <li> <i class="dashicons dashicons-yes"></i><?php printf(__fs('after-x-pay-as-little-y', $api->slug), $trial_period, '<var class="fs-price">' . $this->get_price_tag($plan, $plan->pricing[0]) . '</var>'); ?> </li> </ul> <?php } ?> </div> </div> </div> <?php } ?> <?php } ?> <?php } ?> <div> <h3><?php _efs('details', $api->slug); ?> </h3> <ul> <?php if (!empty($api->version)) { ?> <li><strong><?php _e('Version:'); ?> </strong> <?php echo $api->version; ?> </li> <?php } if (!empty($api->author)) { ?> <li> <strong><?php _e('Author:'); ?> </strong> <?php echo links_add_target($api->author, '_blank'); ?> </li> <?php } if (!empty($api->last_updated)) { ?> <li><strong><?php _e('Last Updated:'); ?> </strong> <span title="<?php echo $api->last_updated; ?> "> <?php printf(__('%s ago'), human_time_diff(strtotime($api->last_updated))); ?> </span></li> <?php } if (!empty($api->requires)) { ?> <li> <strong><?php _e('Requires WordPress Version:'); ?> </strong> <?php printf(__('%s or higher'), $api->requires); ?> </li> <?php } if (!empty($api->tested)) { ?> <li><strong><?php _e('Compatible up to:'); ?> </strong> <?php echo $api->tested; ?> </li> <?php } if (!empty($api->downloaded)) { ?> <li> <strong><?php _e('Downloaded:'); ?> </strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)); ?> </li> <?php } if (!empty($api->slug) && empty($api->external)) { ?> <li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug; ?> /"><?php _e('WordPress.org Plugin Page »'); ?> </a> </li> <?php } if (!empty($api->homepage)) { ?> <li><a target="_blank" href="<?php echo esc_url($api->homepage); ?> "><?php _e('Plugin Homepage »'); ?> </a> </li> <?php } if (!empty($api->donate_link) && empty($api->contributors)) { ?> <li><a target="_blank" href="<?php echo esc_url($api->donate_link); ?> "><?php _e('Donate to this plugin »'); ?> </a> </li> <?php } ?> </ul> </div> <?php if (!empty($api->rating)) { ?> <h3><?php _e('Average Rating'); ?> </h3> <?php wp_star_rating(array('rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings)); ?> <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?> </small> <?php } if (!empty($api->ratings) && array_sum((array) $api->ratings) > 0) { foreach ($api->ratings as $key => $ratecount) { // Avoid div-by-zero. $_rating = $api->num_ratings ? $ratecount / $api->num_ratings : 0; ?> <div class="counter-container"> <span class="counter-label"><a href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?> ?filter=<?php echo $key; ?> " target="_blank" title="<?php echo esc_attr(sprintf(_n('Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key), $key)); ?> "><?php printf(_n('%d star', '%d stars', $key), $key); ?> </a></span> <span class="counter-back"> <span class="counter-bar" style="width: <?php echo 92 * $_rating; ?> px;"></span> </span> <span class="counter-count"><?php echo number_format_i18n($ratecount); ?> </span> </div> <?php } } if (!empty($api->contributors)) { ?> <h3><?php _e('Contributors'); ?> </h3> <ul class="contributors"> <?php foreach ((array) $api->contributors as $contrib_username => $contrib_profile) { if (empty($contrib_username) && empty($contrib_profile)) { continue; } if (empty($contrib_username)) { $contrib_username = preg_replace('/^.+\\/(.+)\\/?$/', '\\1', $contrib_profile); } $contrib_username = sanitize_user($contrib_username); if (empty($contrib_profile)) { echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>"; } else { echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</a></li>"; } } ?> </ul> <?php if (!empty($api->donate_link)) { ?> <a target="_blank" href="<?php echo esc_url($api->donate_link); ?> "><?php _e('Donate to this plugin »'); ?> </a> <?php } ?> <?php } ?> </div> <div id="section-holder" class="wrap"> <?php if (!empty($api->tested) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>')) { echo '<div class="notice notice-warning"><p>' . '<strong>' . __('Warning:') . '</strong> ' . __('This plugin has not been tested with your current version of WordPress.') . '</p></div>'; } else { if (!empty($api->requires) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<')) { echo '<div class="notice notice-warning"><p>' . '<strong>' . __('Warning:') . '</strong> ' . __('This plugin has not been marked as compatible with your version of WordPress.') . '</p></div>'; } } foreach ((array) $api->sections as $section_name => $content) { $content = links_add_base_url($content, 'https://wordpress.org/plugins/' . $api->slug . '/'); $content = links_add_target($content, '_blank'); $san_section = esc_attr($section_name); $display = $section_name === $section ? 'block' : 'none'; if ('description' === $section_name && (!$api->external && $api->wp_org_missing || $api->external && $api->fs_missing)) { $missing_notice = array('type' => 'error', 'id' => md5(microtime()), 'message' => __fs($api->is_paid ? 'paid-addon-not-deployed' : 'free-addon-not-deployed', $api->slug)); fs_require_template('admin-notice.php', $missing_notice); } echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n"; echo $content; echo "\t</div>\n"; } echo "</div>\n"; echo "</div>\n"; echo "</div>\n"; // #plugin-information-scrollable echo "<div id='{$tab}-footer'>\n"; echo $this->get_plugin_cta($api); echo "</div>\n"; iframe_footer(); exit; }
/** * Display plugin information in dialog box form. * * @since 2.7.0 */ function install_plugin_information() { global $tab; if (empty($_REQUEST['plugin'])) { return; } $api = plugins_api('plugin_information', array('slug' => wp_unslash($_REQUEST['plugin']), 'is_ssl' => is_ssl(), 'fields' => array('banners' => true, 'reviews' => true))); if (is_wp_error($api)) { wp_die($api); } $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array('class' => array()), 'span' => array('class' => array()), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); $plugins_section_titles = array('description' => _x('Description', 'Plugin installer section title'), 'installation' => _x('Installation', 'Plugin installer section title'), 'faq' => _x('FAQ', 'Plugin installer section title'), 'screenshots' => _x('Screenshots', 'Plugin installer section title'), 'changelog' => _x('Changelog', 'Plugin installer section title'), 'reviews' => _x('Reviews', 'Plugin installer section title'), 'other_notes' => _x('Other Notes', 'Plugin installer section title')); // Sanitize HTML foreach ((array) $api->sections as $section_name => $content) { $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags); } foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) { if (isset($api->{$key})) { $api->{$key} = wp_kses($api->{$key}, $plugins_allowedtags); } } $_tab = esc_attr($tab); $section = isset($_REQUEST['section']) ? wp_unslash($_REQUEST['section']) : 'description'; // Default to the Description tab, Do not translate, API returns English. if (empty($section) || !isset($api->sections[$section])) { $section_titles = array_keys((array) $api->sections); $section = array_shift($section_titles); } iframe_header(__('Plugin Install')); $_with_banner = ''; if (!empty($api->banners) && (!empty($api->banners['low']) || !empty($api->banners['high']))) { $_with_banner = 'with-banner'; $low = empty($api->banners['low']) ? $api->banners['high'] : $api->banners['low']; $high = empty($api->banners['high']) ? $api->banners['low'] : $api->banners['high']; ?> <style type="text/css"> #plugin-information-title.with-banner { background-image: url( <?php echo esc_url($low); ?> ); } @media only screen and ( -webkit-min-device-pixel-ratio: 1.5 ) { #plugin-information-title.with-banner { background-image: url( <?php echo esc_url($high); ?> ); } } </style> <?php } echo '<div id="plugin-information-scrollable">'; echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>"; echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n"; foreach ((array) $api->sections as $section_name => $content) { if ('reviews' === $section_name && (empty($api->ratings) || 0 === array_sum((array) $api->ratings))) { continue; } if (isset($plugins_section_titles[$section_name])) { $title = $plugins_section_titles[$section_name]; } else { $title = ucwords(str_replace('_', ' ', $section_name)); } $class = $section_name === $section ? ' class="current"' : ''; $href = add_query_arg(array('tab' => $tab, 'section' => $section_name)); $href = esc_url($href); $san_section = esc_attr($section_name); echo "\t<a name='{$san_section}' href='{$href}' {$class}>{$title}</a>\n"; } echo "</div>\n"; ?> <div id="<?php echo $_tab; ?> -content" class='<?php echo $_with_banner; ?> '> <div class="fyi"> <ul> <?php if (!empty($api->version)) { ?> <li><strong><?php _e('Version:'); ?> </strong> <?php echo $api->version; ?> </li> <?php } if (!empty($api->author)) { ?> <li><strong><?php _e('Author:'); ?> </strong> <?php echo links_add_target($api->author, '_blank'); ?> </li> <?php } if (!empty($api->last_updated)) { ?> <li><strong><?php _e('Last Updated:'); ?> </strong> <span title="<?php echo $api->last_updated; ?> "> <?php printf(__('%s ago'), human_time_diff(strtotime($api->last_updated))); ?> </span></li> <?php } if (!empty($api->requires)) { ?> <li><strong><?php _e('Requires WordPress Version:'); ?> </strong> <?php printf(__('%s or higher'), $api->requires); ?> </li> <?php } if (!empty($api->tested)) { ?> <li><strong><?php _e('Compatible up to:'); ?> </strong> <?php echo $api->tested; ?> </li> <?php } if (!empty($api->downloaded)) { ?> <li><strong><?php _e('Downloaded:'); ?> </strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)); ?> </li> <?php } if (!empty($api->slug) && empty($api->external)) { ?> <li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug; ?> /"><?php _e('WordPress.org Plugin Page »'); ?> </a></li> <?php } if (!empty($api->homepage)) { ?> <li><a target="_blank" href="<?php echo esc_url($api->homepage); ?> "><?php _e('Plugin Homepage »'); ?> </a></li> <?php } if (!empty($api->donate_link) && empty($api->contributors)) { ?> <li><a target="_blank" href="<?php echo esc_url($api->donate_link); ?> "><?php _e('Donate to this plugin »'); ?> </a></li> <?php } ?> </ul> <?php if (!empty($api->rating)) { ?> <h3><?php _e('Average Rating'); ?> </h3> <?php wp_star_rating(array('rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings)); ?> <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?> </small> <?php } if (!empty($api->ratings) && array_sum((array) $api->ratings) > 0) { foreach ($api->ratings as $key => $ratecount) { // Avoid div-by-zero. $_rating = $api->num_ratings ? $ratecount / $api->num_ratings : 0; ?> <div class="counter-container"> <a href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?> ?filter=<?php echo $key; ?> " target="_blank" title="<?php echo esc_attr(sprintf(_n('Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key), $key)); ?> "> <span class="counter-label"><?php printf(_n('%d star', '%d stars', $key), $key); ?> </span> <span class="counter-back"> <span class="counter-bar" style="width: <?php echo 92 * $_rating; ?> px;"></span> </span> </a> <span class="counter-count"><?php echo number_format_i18n($ratecount); ?> </span> </div> <?php } } if (!empty($api->contributors)) { ?> <h3><?php _e('Contributors'); ?> </h3> <ul class="contributors"> <?php foreach ((array) $api->contributors as $contrib_username => $contrib_profile) { if (empty($contrib_username) && empty($contrib_profile)) { continue; } if (empty($contrib_username)) { $contrib_username = preg_replace('/^.+\\/(.+)\\/?$/', '\\1', $contrib_profile); } $contrib_username = sanitize_user($contrib_username); if (empty($contrib_profile)) { echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>"; } else { echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</a></li>"; } } ?> </ul> <?php if (!empty($api->donate_link)) { ?> <a target="_blank" href="<?php echo esc_url($api->donate_link); ?> "><?php _e('Donate to this plugin »'); ?> </a> <?php } ?> <?php } ?> </div> <div id="section-holder" class="wrap"> <?php if (!empty($api->tested) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>')) { echo '<div class="error"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>'; } else { if (!empty($api->requires) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<')) { echo '<div class="error"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>'; } } foreach ((array) $api->sections as $section_name => $content) { $content = links_add_base_url($content, 'https://wordpress.org/plugins/' . $api->slug . '/'); $content = links_add_target($content, '_blank'); $san_section = esc_attr($section_name); $display = $section_name === $section ? 'block' : 'none'; echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n"; echo $content; echo "\t</div>\n"; } echo "</div>\n"; echo "</div>\n"; echo "</div>\n"; // #plugin-information-scrollable echo "<div id='{$tab}-footer'>\n"; if (!empty($api->download_link) && (current_user_can('install_plugins') || current_user_can('update_plugins'))) { $status = install_plugin_install_status($api); switch ($status['status']) { case 'install': if ($status['url']) { echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>'; } break; case 'update_available': if ($status['url']) { echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') . '</a>'; } break; case 'newer_installed': echo '<a class="button button-primary right disabled">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>'; break; case 'latest_installed': echo '<a class="button button-primary right disabled">' . __('Latest Version Installed') . '</a>'; break; } } echo "</div>\n"; iframe_footer(); exit; }
$columns = array('post_title_s' => __('Title', 'falite'), 'ID' => __('Slider ID', 'falite'), 'slider_content' => __('Content', 'falite'), 'slider_theme' => __('Slider theme', 'falite')); $sliders_table->columns = $columns; $sliders_table->per_page = 13; // set sortable columns $sortable_columns = array('post_title' => array('post_title', false), 'post_author' => array('post_author', false), 'post_date' => array('post_date', true)); // set delete and edit pages $sliders_table->edit_page = 'featured-articles-pro'; $sliders_table->bulk_actions = false; $sliders_table->sortable_columns = $sortable_columns; // get the records from DB $sliders_table->prepare_items('fa_slider'); // styling and scripts wp_enqueue_style('FA_add_content', FA_path('styles/add_content_modal.css')); wp_enqueue_script('FA_sliders_shortcode', FA_path('scripts/admin/admin_shortcode.js'), array('jquery')); // output iframe header iframe_header(__('Slideshows', 'falite')); ?> <div class="wrap"> <div class="icon32 icon32-posts-page" id="icon-edit"><br></div> <h2><?php _e('Select slideshow', 'falite'); ?> </h2> <?php $sliders_table->display(); ?> </div> <?php // output iframe footer iframe_footer(); die;
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; } }
/** * This is in an iframe * * @return void */ public function do_upgrade_run() { $upgrade_files = array('default_filter.xml', 'Converter.php'); $files = HMWP_MS_Utils::get('files'); $files = explode(',', $files); if (!current_user_can('update_plugins')) { wp_die(__('You do not have sufficient permissions to update Mute Screamer for this site.', 'mute-screamer')); } check_admin_referer('bulk-update-hmwp_ms'); // Valid files to upgrade? foreach ($files as $key => $val) { if (!in_array($val, $upgrade_files)) { wp_die(sprintf(__("%s can't be upgraded.", 'mute-screamer'), esc_html($val))); } // Fetch file contents from cache $files[$val] = $this->remote_get($this->updates['updates'][$val]->revision_file_url); unset($files[$key]); // Remove existing integer based index } require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; require_once 'hmwp_ms/Upgrader.php'; wp_enqueue_script('jquery'); iframe_header(); $upgrader = new HMWP_MS_Upgrader(); $res = $upgrader->upgrade($files); // All good? Clear the update array, reset transients if ($res) { // Remove the files we updated from the update array foreach ($files as $key => $file) { unset($this->updates['updates'][$key]); } // Did we update everything? // Only clear the update array and cache if there are no files left to update if (empty($this->updates['updates'])) { $this->updates['updates'] = array(); delete_site_transient('hmwp_ms_requests_cache'); } set_site_transient('hmwp_ms_update', $this->updates, $this->timeout); } iframe_footer(); }
if (!current_user_can('update_themes')) { wp_die(__('You do not have sufficient permissions to update themes for this site.')); } check_admin_referer('bulk-update-themes'); if (isset($_GET['themes'])) { $themes = explode(',', stripslashes($_GET['themes'])); } elseif (isset($_POST['checked'])) { $themes = (array) $_POST['checked']; } else { $themes = array(); } $themes = array_map('urldecode', $themes); $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes)); $nonce = 'bulk-update-themes'; wp_enqueue_script('updates'); iframe_header(); $upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('nonce', 'url'))); $upgrader->bulk_upgrade($themes); iframe_footer(); } elseif ('install-theme' == $action) { if (!current_user_can('install_themes')) { wp_die(__('You do not have sufficient permissions to install themes on this site.')); } include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; //for themes_api.. check_admin_referer('install-theme_' . $theme); $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false))); //Save on a bit of bandwidth. if (is_wp_error($api)) { wp_die($api); }
/** * Setups the Attendees screen data. */ public function attendees_page_screen_setup() { if (!empty($_GET['action']) && in_array($_GET['action'], array('email'))) { define('IFRAME_REQUEST', true); // Use iFrame Header -- WP Method iframe_header(); // Check if we need to send an Email! if (isset($_POST['tribe-send-email']) && $_POST['tribe-send-email']) { $status = $this->send_attendee_mail_list(); } else { $status = false; } $which_tmpl = sanitize_file_name($_GET['action']); include $this->path . 'src/admin-views/attendees-' . $which_tmpl . '.php'; // Use iFrame Footer -- WP Method iframe_footer(); // We need nothing else here exit; } else { $this->attendees_table = new Tribe__Tickets__Attendees_Table(); $this->maybe_generate_attendees_csv(); add_filter('admin_title', array($this, 'attendees_admin_title'), 10, 2); add_filter('admin_body_class', array($this, 'attendees_admin_body_class')); } }