/** * @global string $wp_version */ public function display_rows() { $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(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array()); $plugins_group_titles = array('Performance' => _x('Performance', 'Plugin installer group title'), 'Social' => _x('Social', 'Plugin installer group title'), 'Tools' => _x('Tools', 'Plugin installer group title')); $group = null; foreach ((array) $this->items as $plugin) { if (is_object($plugin)) { $plugin = (array) $plugin; } // Display the group heading if there is one if (isset($plugin['group']) && $plugin['group'] != $group) { if (isset($this->groups[$plugin['group']])) { $group_name = $this->groups[$plugin['group']]; if (isset($plugins_group_titles[$group_name])) { $group_name = $plugins_group_titles[$group_name]; } } else { $group_name = $plugin['group']; } // Starting a new group, close off the divs of the last one if (!empty($group)) { echo '</div></div>'; } echo '<div class="plugin-group"><h3>' . esc_html($group_name) . '</h3>'; // needs an extra wrapping div for nth-child selectors to work echo '<div class="plugin-items">'; $group = $plugin['group']; } $title = wp_kses($plugin['name'], $plugins_allowedtags); // Remove any HTML from the description. $description = strip_tags($plugin['short_description']); $version = wp_kses($plugin['version'], $plugins_allowedtags); $name = strip_tags($title . ' ' . $version); $author = wp_kses($plugin['author'], $plugins_allowedtags); if (!empty($author)) { $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>'; } $action_links = array(); if (current_user_can('install_plugins') || current_user_can('update_plugins')) { $status = install_plugin_install_status($plugin); switch ($status['status']) { case 'install': if ($status['url']) { /* translators: 1: Plugin name and version. */ $action_links[] = '<a class="install-now button" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Install %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Install Now') . '</a>'; } break; case 'update_available': if ($status['url']) { /* translators: 1: Plugin name and version */ $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr($status['file']) . '" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Update Now') . '</a>'; } break; case 'latest_installed': case 'newer_installed': $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>'; break; } } $details_link = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=600&height=550'); /* translators: 1: Plugin name and version. */ $action_links[] = '<a href="' . esc_url($details_link) . '" class="thickbox" aria-label="' . esc_attr(sprintf(__('More information about %s'), $name)) . '" data-title="' . esc_attr($name) . '">' . __('More Details') . '</a>'; if (!empty($plugin['icons']['svg'])) { $plugin_icon_url = $plugin['icons']['svg']; } elseif (!empty($plugin['icons']['2x'])) { $plugin_icon_url = $plugin['icons']['2x']; } elseif (!empty($plugin['icons']['1x'])) { $plugin_icon_url = $plugin['icons']['1x']; } else { $plugin_icon_url = $plugin['icons']['default']; } /** * Filter the install action links for a plugin. * * @since 2.7.0 * * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now. * @param array $plugin The plugin currently being listed. */ $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin); $date_format = __('M j, Y @ H:i'); $last_updated_timestamp = strtotime($plugin['last_updated']); ?> <div class="plugin-card plugin-card-<?php echo sanitize_html_class($plugin['slug']); ?> "> <div class="plugin-card-top"> <a href="<?php echo esc_url($details_link); ?> " class="thickbox plugin-icon"><img src="<?php echo esc_attr($plugin_icon_url); ?> "/></a> <div class="name column-name"> <h4><a href="<?php echo esc_url($details_link); ?> " class="thickbox"><?php echo $title; ?> </a> </h4> </div> <div class="action-links"> <?php if ($action_links) { echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>'; } ?> </div> <div class="desc column-description"> <p><?php echo $description; ?> </p> <p class="authors"><?php echo $author; ?> </p> </div> </div> <div class="plugin-card-bottom"> <div class="vers column-rating"> <?php wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'])); ?> <span class="num-ratings">(<?php echo number_format_i18n($plugin['num_ratings']); ?> )</span> </div> <div class="column-updated"> <strong><?php _e('Last Updated:'); ?> </strong> <span title="<?php echo esc_attr(date_i18n($date_format, $last_updated_timestamp)); ?> "> <?php printf(__('%s ago'), human_time_diff($last_updated_timestamp)); ?> </span> </div> <div class="column-downloaded"> <?php if ($plugin['active_installs'] >= 1000000) { $active_installs_text = _x('1+ Million', 'Active plugin installs'); } else { $active_installs_text = number_format_i18n($plugin['active_installs']) . '+'; } printf(__('%s Active Installs'), $active_installs_text); ?> </div> <div class="column-compatibility"> <?php if (!empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) { echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>'; } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) { echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>'; } else { echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>'; } ?> </div> </div> </div> <?php } // Close off the group divs of the last one if (!empty($group)) { echo '</div></div>'; } }
public function get_status() { if (!function_exists('install_plugin_install_status')) { require ABSPATH . 'wp-admin/includes/plugin-install.php'; } return install_plugin_install_status($this->get()); }
public function manage() { if (!function_exists('plugins_api')) { require_once ABSPATH . '/wp-admin/includes/plugin-install.php'; } preg_match_all('/####([\\d\\w\\-]{1,})####/', $this->template, $plugin_list); if (isset($plugin_list[1]) && is_array($plugin_list[1])) { $search = array(); foreach ($plugin_list[1] as $plugin) { $api = plugins_api('plugin_information', array('slug' => stripslashes($plugin))); $status = install_plugin_install_status($api); switch ($status['status']) { case 'install': $search["####{$plugin}####"] = isset($status['url']) ? $status['url'] : 'javascript:void();'; $search["###{$plugin}-install-text###"] = __('Install Now'); break; case 'update_available': $search["####{$plugin}####"] = isset($status['url']) ? $status['url'] : 'javascript:void();'; $search["###{$plugin}-install-text###"] = __('Install Update Now'); break; case 'newer_installed': $search["####{$plugin}####"] = 'javascript:void();'; $search["###{$plugin}-install-text###"] = sprintf(__('Newer Version (%s) Installed'), $status['version']); break; case 'latest_installed': $search["####{$plugin}####"] = 'javascript:void();'; $search["###{$plugin}-install-text###"] = __('Latest Version Installed'); break; } } $this->template = str_replace(array_keys($search), $search, $this->template); } echo $this->template; }
protected function execute(InputInterface $input, OutputInterface $output) { $env = Validators::validateEnv($input->getOption('env')); $root = $this->skeleton->getWebRoot(); $plugins = $this->skeleton->get(sprintf('wordpress.%s.plugins', $env)); require $root . '/wp-load.php'; require ABSPATH . 'wp-admin/includes/admin.php'; require ABSPATH . 'wp-admin/includes/plugin-install.php'; foreach ($plugins as $slug => $version) { $plugin = plugins_api('plugin_information', array('slug' => $slug)); if (is_wp_error($plugin)) { throw new \Exception('Could not get plugin information for ' . $slug); } if ($version) { list($prefix) = explode($slug, $plugin->download_link); $link = sprintf('%s%s.%s.zip', $prefix, $slug, $version); $response = wp_remote_head($link); if (!isset($response['response']['code']) || $response['response']['code'] != 200) { throw new \Exception('Unable to verify ' . $link); } $plugin->download_link = $link; $plugin->version = $version; } require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; $status = install_plugin_install_status($plugin); $upgrader = new \Plugin_Upgrader(new UpgraderSkin($output)); $current = current(get_plugins("/{$slug}")); switch ($status['status']) { case 'install': $output->write(sprintf('Installing <info>%s</info> v<comment>%s</comment>', $plugin->name, $plugin->version)); $upgrader->install($plugin->download_link); break; case 'update_available': if ($plugin->version == $current['Version']) { $output->writeln(sprintf('<info>%s</info> v<comment>%s</comment> is already installed!', $plugin->name, $plugin->version)); } else { $output->write(sprintf('Upgrading <info>%s</info> from <comment>%s</comment> to <comment>%s</comment>', $plugin->name, $current['Version'], $plugin->version)); $file = sprintf('%s/%s', $slug, key(get_plugins("/{$slug}"))); $upgrader->upgrade($file); } break; case 'latest_installed': $output->writeln(sprintf('<info>%s</info> v<comment>%s</comment> is already installed!', $plugin->name, $current['Version'])); break; case 'newer_installed': $output->writeln(sprintf('<info>%s</info> v<comment>%s</comment> is installed & newer than <comment>%s</comment>', $plugin->name, $current['Version'], $plugin->version)); break; } } if ($plugins) { $output->writeln(sprintf('<info>Activate plugins in the WordPress Admin</info>', $plugin->name)); } }
public function change_action_links($action_links, $plugin) { $action_links = array(); if (current_user_can('install_plugins') || current_user_can('update_plugins')) { $status = install_plugin_install_status($plugin); $tracking = '?utm_source=Add-New-Plugin&utm_medium=Action-Link&utm_content=' . $_SERVER['HTTP_HOST'] . '&utm_campaign=Add-new-plugins-action-links'; switch ($status['status']) { case 'install': if ($status['url']) { $action_links[] = '<a class="install-now button" href="http://realbigplugins.com/plugins/' . $plugin['slug'] . '/' . $tracking . '" aria-label="' . esc_attr(sprintf(__('Download %s now'), $name)) . '">' . __('Download Now') . '</a>'; } else { $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>'; } break; case 'update_available': if ($status['url']) { $action_links[] = '<a class="button" href="' . $status['url'] . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '">' . __('Update Now') . '</a>'; } break; case 'latest_installed': case 'newer_installed': $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>'; break; } } $details_link = 'http://realbigplugins.com/plugins/' . $plugin['slug'] . '/' . $tracking . '&TB_iframe=true&width=600&height=550'; $action_links[] = '<a href="' . esc_url($details_link) . '" class="thickbox" aria-label="' . esc_attr(sprintf(__('More information about %s'), $name)) . '" data-title="' . esc_attr($name) . '">' . __('More Details') . '</a>'; return $action_links; }
/** * 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; }
/** * Plugin option page */ function easy_table_page() { ?> <div class="wrap easy-table-wrap"> <div class="icon32"><img src="<?php echo plugins_url('/images/icon-table.png', __FILE__); ?> " /></div> <h2 class="nav-tab-wrapper"> <a href="options-general.php?page=<?php echo $this->easy_table_base('plugin-domain'); ?> " class="nav-tab <?php echo !isset($_GET['gettab']) ? 'nav-tab-active' : ''; ?> "><?php printf(__('%s Option', 'easy-table'), $this->easy_table_base('name')); ?> </a> <?php /** currently not available <a href="options-general.php?page=<?php echo $this->easy_table_base('plugin-domain');?>&gettab=themes" class="nav-tab <?php echo (isset($_GET['gettab']) AND ($_GET['gettab'] == 'themes')) ? 'nav-tab-active' : '';?>"><?php _e('Themes','easy-table');?></a> */ ?> <a href="options-general.php?page=<?php echo $this->easy_table_base('plugin-domain'); ?> &gettab=support" class="nav-tab <?php echo (isset($_GET['gettab']) and $_GET['gettab'] == 'support') ? 'nav-tab-active' : ''; ?> "><?php _e('Support', 'easy-table'); ?> </a> <a href="options-general.php?page=<?php echo $this->easy_table_base('plugin-domain'); ?> &gettab=about" class="nav-tab <?php echo (isset($_GET['gettab']) and $_GET['gettab'] == 'about') ? 'nav-tab-active' : ''; ?> "><?php _e('About', 'easy-table'); ?> </a> </h2> <?php if (!isset($_GET['gettab'])) { ?> <div class="left"> <form method="post" action="options.php"> <?php wp_nonce_field('update-options'); settings_fields('easy_table_option_field'); ?> <span class="togglethis toggledesc"><em><a href="#" data-target=".help-btn"><?php _e('Show/hide help button'); ?> </a></em></span> <h3><?php _e('General options', 'easy-table'); ?> </h3> <?php $fields = array(array('name' => 'easy_table_plugin_option[shortcodetag]', 'label' => __('Short code tag', 'easy-table'), 'type' => 'text', 'description' => __('Shortcode tag, type \'table\' if you want to use [table] short tag.', 'easy-table'), 'value' => $this->option('shortcodetag')), array('name' => 'easy_table_plugin_option[attrtag]', 'label' => __('Cell attribute tag', 'easy-table'), 'type' => 'text', 'description' => __('Cell attribute tag, default is attr.', 'easy-table'), 'value' => $this->option('attrtag')), array('name' => 'easy_table_plugin_option[tablewidget]', 'label' => __('Also render table in widget?', 'easy-table'), 'type' => 'checkbox', 'description' => __('Check this if you want the table could be rendered in widget.', 'easy-table'), 'value' => 1, 'attr' => $this->option('tablewidget') ? 'checked="checked"' : ''), array('type' => 'checkboxgroup', 'grouplabel' => __('Only load JS/CSS when in this condition', 'easy-table'), 'description' => __('Please check in where JavaScript and CSS should be loaded', 'easy-table'), 'groupitem' => array(array('name' => 'easy_table_plugin_option[scriptloadin][]', 'label' => __('Single', 'easy-table'), 'value' => 'is_single', 'attr' => in_array('is_single', $this->option('scriptloadin')) ? 'checked="checked"' : ''), array('name' => 'easy_table_plugin_option[scriptloadin][]', 'label' => __('Page', 'easy-table'), 'value' => 'is_page', 'attr' => in_array('is_page', $this->option('scriptloadin')) ? 'checked="checked"' : ''), array('name' => 'easy_table_plugin_option[scriptloadin][]', 'label' => __('Front page', 'easy-table'), 'value' => 'is_home', 'attr' => in_array('is_home', $this->option('scriptloadin')) ? 'checked="checked"' : ''), array('name' => 'easy_table_plugin_option[scriptloadin][]', 'label' => __('Archive page', 'easy-table'), 'value' => 'is_archive', 'attr' => in_array('is_archive', $this->option('scriptloadin')) ? 'checked="checked"' : ''), array('name' => 'easy_table_plugin_option[scriptloadin][]', 'label' => __('Search page', 'easy-table'), 'value' => 'is_search', 'attr' => in_array('is_search', $this->option('scriptloadin')) ? 'checked="checked"' : ''))), array('name' => 'easy_table_plugin_option[scriptinfooter]', 'label' => __('Load script on footer?', 'easy-table'), 'type' => 'checkbox', 'description' => __('Check this if you want the script to be rendered in footer. Try to check or uncheck this if you experienced conflict with another JavaScript library (not guaranteed though).', 'easy-table'), 'value' => 1, 'attr' => $this->option('scriptinfooter') ? 'checked="checked"' : '')); echo $this->render_form($fields); $fields = array(array('name' => 'easy_table_plugin_option[tablesorter]', 'label' => __('Use tablesorter?', 'easy-table'), 'type' => 'checkbox', 'value' => 1, 'description' => __('Check this to use tablesorter jQuery plugin', 'easy-table'), 'attr' => $this->option('tablesorter') ? 'checked="checked"' : ''), array('name' => 'easy_table_plugin_option[th]', 'label' => __('Use TH for the first row?', 'easy-table'), 'type' => 'checkbox', 'value' => 1, 'description' => __('Check this if you want to use first row as table head (required by tablesorter)', 'easy-table'), 'attr' => $this->option('th') ? 'checked="checked"' : ''), array('name' => 'easy_table_plugin_option[loadcss]', 'label' => __('Load CSS?', 'easy-table'), 'type' => 'checkbox', 'value' => 1, 'description' => __('Check this to use CSS included in this plugin to styling table, you may unceck if you want to write your own style.', 'easy-table'), 'attr' => $this->option('loadcss') ? 'checked="checked"' : ''), array('name' => 'easy_table_plugin_option[class]', 'label' => __('Table class', 'easy-table'), 'type' => 'text', 'description' => __('Additional table class attribute.', 'easy-table'), 'value' => $this->option('class')), array('name' => 'easy_table_plugin_option[width]', 'label' => __('Table width', 'easy-table'), 'type' => 'text', 'description' => __('Table width, in pixel or percent (may be overriden by CSS)', 'easy-table'), 'value' => $this->option('width')), array('name' => 'easy_table_plugin_option[border]', 'label' => __('Table border', 'easy-table'), 'type' => 'text', 'description' => __('Table border (may be overriden by CSS)', 'easy-table'), 'value' => $this->option('border')), array('name' => 'easy_table_plugin_option[align]', 'label' => __('Table align', 'easy-table'), 'type' => 'text', 'description' => __('Table align (left, center, right)', 'easy-table'), 'value' => $this->option('align'))); ?> <h3><?php _e('Table options', 'easy-table'); ?> </h3> <?php echo $this->render_form($fields); ?> <h3><?php _e('Theme selector', 'easy-table'); ?> </h3> <?php $fields = array(array('name' => 'easy_table_plugin_option[theme]', 'label' => __('Default theme', 'easy-table'), 'type' => 'select', 'value' => $this->option('theme'), 'values' => array_combine($this->themes(), $this->themes()), 'description' => __('Select default theme of the table', 'easy-table'))); echo $this->render_form($fields); ?> <h3><?php _e('Data options', 'easy-table'); ?> </h3> <?php $fields = array(array('name' => 'easy_table_plugin_option[limit]', 'label' => __('Row limit', 'easy-table'), 'type' => 'text', 'value' => $this->option('limit'), 'rowclass' => 'new', 'description' => __('Max row to convert to table, default 0 (unlimited)', 'easy-table')), array('name' => 'easy_table_plugin_option[trim]', 'label' => __('Trim cell data?', 'easy-table'), 'type' => 'checkbox', 'value' => 1, 'attr' => $this->option('trim') ? 'checked="checked"' : '', 'rowclass' => 'new', 'description' => __('Trim empty character around cell data', 'easy-table'))); echo $this->render_form($fields); ?> <h3><?php _e('Parser options', 'easy-table'); ?> </h3> <p><em><?php _e('Do not change this unless you know what you\'re doing', 'easy-table'); ?> </em> </p> <?php $fields = array(array('name' => 'easy_table_plugin_option[nl]', 'label' => __('New line replacement', 'easy-table'), 'type' => 'text', 'value' => $this->option('nl'), 'description' => __('Since new line is used by parser, you need specify character as a replacement.', 'easy-table')), array('name' => 'easy_table_plugin_option[terminator]', 'label' => __('Row terminator', 'easy-table'), 'type' => 'text', 'value' => $this->option('terminator'), 'rowclass' => 'new', 'description' => __('This caharacter will converted into new row. Default value \\n (this is invisible character when you press Enter). If your new line not converted as new row in the table, try use \\r instead.', 'easy-table')), array('name' => 'easy_table_plugin_option[delimiter]', 'label' => __('Delimiter', 'easy-table'), 'type' => 'text', 'value' => $this->option('delimiter'), 'description' => __('CSV delimiter (default is comma)', 'easy-table')), array('name' => 'easy_table_plugin_option[enclosure]', 'label' => __('Enclosure', 'easy-table'), 'type' => 'text', 'value' => htmlentities($this->option('enclosure')), 'description' => __('CSV enclosure (default is double quote)', 'easy-table')), array('name' => 'easy_table_plugin_option[escape]', 'label' => __('Escape', 'easy-table'), 'type' => 'text', 'value' => $this->option('escape'), 'description' => __('CSV escape (default is backslash)', 'easy-table')), array('name' => 'easy_table_plugin_option[fixlinebreak]', 'label' => __('Fix linebreak', 'easy-table'), 'type' => 'checkbox', 'value' => 1, 'description' => __('If terminator is not default (linebreak), you may encounter some issue with linebreak inside cell, try to check or uncheck this to resolve', 'easy-table'), 'attr' => $this->option('fixlinebreak') ? 'checked="checked"' : ''), array('name' => 'easy_table_plugin_option[csvfile]', 'label' => __('Allow read CSV from file?', 'easy-table'), 'type' => 'checkbox', 'value' => 1, 'description' => __('Check this if you also want to convert CSV file to table', 'easy-table'), 'attr' => $this->option('csvfile') ? 'checked="checked"' : '')); echo $this->render_form($fields); ?> <input type="hidden" name="action" value="update" /> <input type="hidden" name="easy_table_option_field" value="easy_table_plugin_option" /> <p><input type="submit" class="button-primary" value="<?php _e('Save', 'easy-table'); ?> " /> </p> </form> </div> <div class="right"> <?php $defaulttableexample = ' [table caption="Just test table" width="500" colwidth="20|100|50" colalign="left|left|center|left|right"] no,head1,head2,head3,head4 1,row1col1,row1col2,row1col3,100 2,row2col1,row2col2,row2col3,20000 3,row3col1,,row3col3,1405 4,row4col1,row4col2,row4col3,23023 [/table] '; $tableexample = $defaulttableexample; if (isset($_POST['test-easy-table'])) { $tableexample = $_POST['easy-table-test-area']; } if (isset($_POST['test-easy-table-reset'])) { $tableexample = $defaulttableexample; } ?> <h3><?php _e('Possible parameter', 'easy-table'); ?> </h3> <p><?php _e('These parameters commonly can override global options in the left side of this page. Example usage:', 'easy-table'); ?> </p> <p> <code>[table param1="param-value1" param2="param-value2"]table data[/table]</code></p> <ol> <li><strong>class</strong>, <?php _e('default value', 'easy-table'); ?> <em>'table-striped'</em>, <?php _e('another value', 'easy-table'); ?> <em>table-bordered, table-striped, table-condensed</em></li> <li><strong>caption</strong>,<?php _e('default value', 'easy-table'); ?> <em>''</em></li> <li><strong>width</strong>, <?php _e('default value', 'easy-table'); ?> <em>'100%'</em></li> <li><strong>align</strong>, <?php _e('default value', 'easy-table'); ?> <em>'left'</em></li> <li><strong>th</strong>, <?php _e('default value', 'easy-table'); ?> <em>'true'</em></li> <li><strong>tf</strong>, <?php _e('default value', 'easy-table'); ?> <em>'false'</em></li> <li><strong>border</strong>, <?php _e('default value', 'easy-table'); ?> <em>'0'</em></li> <li><strong>id</strong>, <?php _e('default value', 'easy-table'); ?> <em>'false'</em></li> <li><strong>tablesorter</strong>, <?php _e('default value', 'easy-table'); ?> <em>'false'</em></li> <li><strong>file</strong>, <?php _e('default value', 'easy-table'); ?> <em>'false'</em></li> <li><strong>sort</strong>, <?php _e('default value', 'easy-table'); ?> <em>''</em></li> <li class="new"><strong>trim</strong>, <?php _e('default value', 'easy-table'); ?> <em>false</em></li> <li class="new"><strong>style</strong>, <?php _e('default value', 'easy-table'); ?> <em>''</em></li> <li class="new"><strong>limit</strong>, <?php _e('default value', 'easy-table'); ?> <em>0</em></li> <li class="new"><strong>terminator</strong>, <?php _e('default value', 'easy-table'); ?> <em>\n</em></li> <li class="new"><strong>colalign</strong>, <?php _e('default value', 'easy-table'); ?> <em>''</em>, see example on the test area</li> <li class="new"><strong>colwidth</strong>, <?php _e('default value', 'easy-table'); ?> <em>''</em>, see example on the test area</li> </ol> <h3><?php printf('Example usage of %s parameter', 'sort', 'easy-table'); ?> </h3> <p><em>sort</em> <?php _e('parameter is for initial sorting order. Value for each column separated by comma. See example below:', 'easy-table'); ?> </p> <ol> <li><?php _e('Set initial order of first column descending and second column ascending:', 'easy-table'); ?> <pre><code>[table sort="desc,asc"] col1,col2,col3 col4,col5,col6 [/table]</code></pre> </li> <li><?php _e('Set initial order of second column descending:', 'easy-table'); ?> <pre><code>[table sort=",desc,asc"] col1,col2,col3 col4,col5,col6 [/table]</code></pre> </li> <li><?php _e('Additionaly, sort option also can be set via sort attr in a cell. See example below', 'easy-table'); ?> </li> </ol> <h3><?php _e('Cell attribute tag', 'easy-table'); ?> </h3> <ol> <li><p><strong>attr</strong>, <?php _e('To set attribute for cell eg. class, colspan, rowspan, etc', 'easy-table'); ?> </p> <p><?php _e('Example', 'easy-table'); ?> : </p> <pre><code>[table] col1,col2[attr style="width:200px" class="someclass"],col3 col4,col5,col6 [/table] </code></pre> </li> <li><p><strong>attr sort</strong>, <?php _e('To set initial sort order, this is intended to TH (first row) only.', 'easy-table'); ?> </p> <p><?php _e('Example: sort second column descending ', 'easy-table'); ?> </p> <pre><code>[table] col1,col2[attr sort="desc"],col3 col4,col5,col6 [/table] </code></pre> <p><?php printf('To disable sort, use "%s". In the example below first column is not sortable', 'false', 'easy-table'); ?> </p> <pre><code>[table] col1[attr sort="false"],col2,col3 col4,col5,col6 [/table] </code></pre> </li> </ol> <h3><?php _e('Test area:', 'easy-table'); ?> </h3> <form action="" method="post"> <textarea name="easy-table-test-area" style="width:500px;height:200px;border:1px solid #ccc"><?php echo trim(htmlentities(stripslashes($tableexample))); ?> </textarea> <input type="hidden" name="test-easy-table" value="1" /> <p><input class="button" type="submit" name="test-easy-table-reset" value="<?php _e('Reset', 'easy-table'); ?> " /> <input class="button-primary" type="submit" value="<?php _e('Update preview', 'easy-table'); ?> »" /></p></form> <div> <h3><?php _e('Preview', 'easy-table'); ?> </h3> <?php echo do_shortcode(stripslashes($tableexample)); ?> </div> </div> <div class="clear"></div> <?php } elseif ($_GET['gettab'] == 'themes') { ?> <h3><?php _e('Easy Table theme editor'); ?> </h3> <div class="row"> <div class="columns nine"> <textarea name="" id="easy-table-theme-editor"><?php echo esc_textarea($this->theme_content()); ?> </textarea> <input type="submit" class="button primary" value="Save"/> </div> <div class="columns three"> <ul> <?php foreach ($this->themes() as $theme) { echo ' <li><a href="#">' . $theme . '</a> <a href="options-general.php?page=easy-table&gettab=themes&edit=' . $theme . '">edit</a> <a href="&edit-theme=1&clone=1#">clone</a> <a href="#">delete</a> <a href="#">preview</a> </li>'; } ?> </ul> <form action=""> New theme: <br/> <input type="text" value="" placeholder="Theme name" name="themename"/> <input type="submit" value="Create"/> </form> </div> </div> <?php } elseif ($_GET['gettab'] == 'support') { ?> <p><?php _e('I have tried to make this plugin can be used as easy as possible and documentation as complete as possible. However it is also possible that you are still confused. Therefore feel free to ask. I would be happy to answer.', 'easy-table'); ?> </p> <p><?php _e('You can use this discussion to get support, request feature or reporting bug.', 'easy-table'); ?> </p> <p><a target="_blank" href="http://takien.com/plugins/easy-table"><?php _e('Before you ask something, make sure you have read documentation here!', 'easy-table'); ?> </a></p> <div id="disqus_thread"></div> <script type="text/javascript"> /* <![CDATA[ */ var disqus_url = 'http://takien.com/1126/easy-table-is-the-easiest-way-to-create-table-in-wordpress.php'; var disqus_identifier = '1126 http://takien.com/?p=1126'; var disqus_container_id = 'disqus_thread'; var disqus_domain = 'disqus.com'; var disqus_shortname = 'takien'; var disqus_title = "Easy Table is The Easiest Way to Create Table in WordPress"; var disqus_config = function () { var config = this; config.callbacks.preData.push(function() { // clear out the container (its filled for SEO/legacy purposes) document.getElementById(disqus_container_id).innerHTML = ''; }); config.callbacks.onReady.push(function() { // sync comments in the background so we don't block the page DISQUS.request.get('?cf_action=sync_comments&post_id=1126'); }); }; var facebookXdReceiverPath = 'http://takien.com/wp-content/plugins/disqus-comment-system/xd_receiver.htm'; /* ]]> */ </script> <script type="text/javascript"> /* <![CDATA[ */ var DsqLocal = { 'trackbacks': [ ], 'trackback_url': "http:\/\/takien.com\/1126\/easy-table-is-the-easiest-way-to-create-table-in-wordpress.php\/trackback" }; /* ]]> */ </script> <script type="text/javascript"> /* <![CDATA[ */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http' + '://' + disqus_shortname + '.' + disqus_domain + '/embed.js?pname=wordpress&pver=2.72'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); /* ]]> */ </script> <?php } elseif ($_GET['gettab'] == 'about') { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $api = plugins_api('plugin_information', array('slug' => 'easy-table')); ?> <div> <h2 class="mainheader"><?php echo $this->easy_table_base('name') . ' ' . $this->easy_table_base('version'); ?> </h2> <?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 class="red" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') . '</a>'; } break; case 'newer_installed': echo '<a class="green">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>'; break; case 'latest_installed': echo '<a class="green">' . __('Latest Version Installed') . '</a>'; break; } ?> </p> <?php } ?> <ul> <?php if (!empty($api->version)) { ?> <li><strong><?php _e('Latest Version:', 'easy-table'); ?> </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)) { ?> <h3><?php _e('Average Rating'); ?> </h3> <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)); ?> "> <?php if (version_compare($GLOBALS['wp_version'], 3.4, '<')) { ?> <div class="star star-rating" style="width: <?php echo esc_attr($api->rating); ?> px"></div> <div class="star star5"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?> " alt="<?php esc_attr_e('5 stars'); ?> " /></div> <div class="star star4"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?> " alt="<?php esc_attr_e('4 stars'); ?> " /></div> <div class="star star3"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?> " alt="<?php esc_attr_e('3 stars'); ?> " /></div> <div class="star star2"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?> " alt="<?php esc_attr_e('2 stars'); ?> " /></div> <div class="star star1"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?> " alt="<?php esc_attr_e('1 star'); ?> " /></div> <?php } else { ?> <div class="star star-rating" style="width: <?php echo esc_attr(str_replace(',', '.', $api->rating)); ?> px"></div> <?php } ?> </div> <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?> </small> <h3><?php _e('Support my work with donation', 'easy-table'); ?> :</h3> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHdwYJKoZIhvcNAQcEoIIHaDCCB2QCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBiuJYBc1lBF7rbfQavcpZgzT8RvZGjID2Js94j7ju/SRNVtn+UPciq7Bi5fEWsM9WwVx52bndEV+WvBdQe3t2bV3EAXY8I3J2bAWczePAlZEcLy0umSnQGnRPIAZ9mk/JUKRAJmvd43rBkNqjzlhNXTSprXT0n2Vyqmq76WG6hJjELMAkGBSsOAwIaBQAwgfQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIC8jF6f82My+AgdAjf0SuFu46mt7lttlZYr5Z5U2CJIFyi51ihjPnZsxpoL0ekeLCAP8tFmo2cQM5ne/qx9oE9lE5Jfnxl+uoK1F2HOlxKl+x+jv7dsuMHUCJpULyq8/UsrJ3FXr8bZNAfKhJwtyswKpEiSyhBndkVj9vbeoH0V1+EoRmsyCcKs2qZKnVQQ/saz86aftIMYJ2r4yMBt10U8SUHC4Eq1JMWvAPNAPLoR6JQSYcF5z1HjhOHtnoFgfSOfP32CojuP9sRBOPUfvS20k9GWMxKEiD0u9RoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTIwNzAxMDM0ODUwWjAjBgkqhkiG9w0BCQQxFgQU7GSbNXKovs7xPIkMognrn2q5DgwwDQYJKoZIhvcNAQEBBQAEgYB+x+XRIPErAHovudsWOwNV/9LJWlBTkRTfR1zNnO1I4pYrzAJ6MR4I0vsmvZSmvwIfcyNPLxc3ouRK2esTFVfKv/ICHYrTCXSGusyROWOlQRiQJvoQ65IUiW6HvBz81/JjRp5TNgAAbgEY9GlddvdVsjsVbqfroqI2GIvdTNY+6w==-----END PKCS7----- "> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> <p><?php _e('Don\'t have money? No problem, you can rate my plugin instead.', 'easy-table'); ?> <a target="_blank" href="http://wordpress.org/extend/plugins/easy-table/"><?php _e('Click here to rate', 'easy-table'); ?> </a></p> <h3><?php _e('Thanks to', 'easy-table'); ?> :</h3> <ul> <li><a target="_blank" href="<?php echo site_url(); ?> ">You</a></li> <li><a target="_blank" href="http://php.net">PHP</a></li> <li><a target="_blank" href="http://wordpress.org">WordPress</a></li> <li>Tablesorter <?php _e('by', 'easy-table'); ?> <a target="_blank" href="http://tablesorter.com">Christian Bach</a></li> <li>CSS <?php _e('by', 'easy-table'); ?> <a target="_blank" href="http://twitter.github.com/bootstrap">Twitter Bootstrap</a></li> <li>jQuery metadata <?php _e('by', 'easy-table'); ?> <a target="_blank" href="https://github.com/jquery/jquery-metadata/">John Resig</a></li> <li>CuscoSky table styles <?php _e('by', 'easy-table'); ?> <a target="_blank" href="http://www.buayacorp.com">Braulio Soncco</a></li> <li>Tablesorter updated version <?php _e('by', 'easy-table'); ?> <a target="_blank" href="https://github.com/Mottie/tablesorter">Rob Garrison</a></li> </ul> <?php } ?> </div> <?php } ?> </div><!--wrap--> <?php }
function icp_free_plugins_page() { // run a quick security check if (!check_ajax_referer('icp_free_plugins_nonce', 'security')) { return; } ob_start(); include ABSPATH . "wp-admin/includes/plugin-install.php"; global $tabs, $tab, $paged, $type, $term; $tabs = array(); $tab = "search"; $per_page = 30; $args = array("author" => "GhozyLab", "page" => $paged, "per_page" => $per_page, "fields" => array("last_updated" => true, "downloaded" => true, "icons" => true), "locale" => get_locale()); $args = apply_filters("install_plugins_table_api_args_{$tab}", $args); $api = plugins_api("query_plugins", $args); $item = $api->plugins; $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())); ?> <form id="plugin-filter"> <div class="wrap"> <div style="margin-top:30px;" class="wp-list-table widefat plugin-install"> <div id="the-list"> <?php foreach ((array) $item as $plugin) { if (is_object($plugin)) { $plugin = (array) $plugin; } $title = wp_kses($plugin['name'], $plugins_allowedtags); // Remove any HTML from the description. $description = strip_tags($plugin['short_description']); $version = wp_kses($plugin['version'], $plugins_allowedtags); $name = strip_tags($title . ' ' . $version); $author = wp_kses($plugin['author'], $plugins_allowedtags); if (!empty($author)) { $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>'; } $action_links = array(); if (current_user_can('install_plugins') || current_user_can('update_plugins')) { $status = install_plugin_install_status($plugin); switch ($status['status']) { case 'install': if ($status['url']) { /* translators: 1: Plugin name and version. */ $action_links[] = '<a class="install-now button-secondary icp-button-install" href="' . $status['url'] . '" aria-label="' . esc_attr(sprintf(__('Install %s now'), $name)) . '">' . __('Install Now') . '</a>'; } break; case 'update_available': if ($status['url']) { /* translators: 1: Plugin name and version */ $action_links[] = '<a class="button icp-button-update" href="' . $status['url'] . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '">' . __('Update Now') . '</a>'; } break; case 'latest_installed': case 'newer_installed': $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>'; break; } } $details_link = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=750&height=550'); /* translators: 1: Plugin name and version. */ $action_links[] = '<a href="' . esc_url($details_link) . '" class="thickbox" aria-label="' . esc_attr(sprintf(__('More information about %s'), $name)) . '" data-title="' . esc_attr($name) . '">' . __('More Details') . '</a>'; if (!empty($plugin['icons']['svg'])) { $plugin_icon_url = $plugin['icons']['svg']; } elseif (!empty($plugin['icons']['2x'])) { $plugin_icon_url = $plugin['icons']['2x']; } elseif (!empty($plugin['icons']['1x'])) { $plugin_icon_url = $plugin['icons']['1x']; } else { $plugin_icon_url = $plugin['icons']['default']; } /** * Filter the install action links for a plugin. * * @since 2.7.0 * * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now. * @param array $plugin The plugin currently being listed. */ $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin); ?> <div class="plugin-card drop-shadow lifted"> <div class="plugin-card-top" style="min-height: 190px !important;"> <?php if (isset($plugin["slug"]) && $plugin["slug"] == 'easy-media-gallery') { echo '<div class="most_popular"></div>'; } ?> <a href="<?php echo esc_url($details_link); ?> " class="thickbox plugin-icon"><img width="128" height="128" src="<?php echo esc_attr($plugin_icon_url); ?> " /></a> <div class="name column-name" style="margin-right: 20px !important;"> <h4 style="font-size:1.5em;"><a href="<?php echo esc_url($details_link); ?> " class="thickbox"><?php echo $title; ?> </a></h4> </div> <div class="desc column-description" style="margin-right: 20px !important;"> <p><?php echo $description; ?> </p> <p class="authors"><?php echo $author; ?> </p> </div> </div> <div class="icp-button-con"> <?php if ($action_links) { echo '<ul class="icp-plugin-action-buttons">'; echo '<li>' . $action_links[0] . '</li>'; switch ($plugin["slug"]) { case "easy-media-gallery": echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://ghozylab.com/plugins/easy-media-gallery-pro/demo/" target="_blank">PRO VERSION DEMO</a></li>'; break; case "image-slider-widget": echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://demo.ghozylab.com/plugins/easy-image-slider-plugin/image-slider-with-thumbnails-at-the-bottom/" target="_blank">PRO VERSION DEMO</a></li>'; break; case "easy-notify-lite": echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://ghozylab.com/plugins/easy-notify-pro/demo/" target="_blank">PRO VERSION DEMO</a></li>'; break; case "contact-form-lite": echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://demo.ghozylab.com/plugins/easy-contact-form-plugin/contact-form-recaptcha/" target="_blank">PRO VERSION DEMO</a></li>'; break; default: break; } echo '</ul>'; } ?> </div> <div class="plugin-card-bottom"> <div class="column-updated"> <strong><?php _e('Last Updated:'); ?> </strong> <span title="<?php echo esc_attr($plugin['last_updated']); ?> "> <?php printf(__('%s ago'), human_time_diff(strtotime($plugin['last_updated']))); ?> </span> </div> <div class="column-downloaded"> <?php echo sprintf(_n('%s download', '%s downloads', $plugin['downloaded']), number_format_i18n($plugin['downloaded'])); ?> </div> <div class="column-compatibility"> <?php if (!empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) { echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>'; } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) { echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>'; } else { echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>'; } ?> </div> </div> </div> <?php } ?> </div> </div> </div> </form> <?php $res = ob_get_clean(); echo $res; wp_die(); }
/** * 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; }
/** * * @param type $slug * * @return type */ public function pluginStatus($slug) { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $plugin = plugins_api('plugin_information', array('slug' => $slug)); return install_plugin_install_status($plugin); }
public function render_menu_page_plugins() { $plugins = (array) $this->get_plugins(); ?> <div id="welcome-panel" class="welcome-panel"> <div class="welcome-panel-content"> <h2><?php _e('Meet the plugins that meet our high standards.', 'gd_system'); ?> </h2> <p class="about-description"><?php _e("We've partnered with the world’s top WordPress plugin authors to provide a list of plugins that work well with GoDaddy WordPress hosting.", 'gd_system'); ?> </p> </div> </div> <div id="plugin-filter"> <div class="wp-list-table widefat plugin-install"> <h2 class="screen-reader-text"><?php _e('Plugins list'); ?> </h2> <div id="the-list"> <?php if (!$plugins) { ?> <div class="error"> <p><?php _e('Whoops! There was a problem fetching the list of plugins, please try reloading this page.', 'gd_system'); ?> </p> </div> <?php } ?> <?php foreach ($plugins as $plugin) { if (!function_exists('install_plugin_install_status')) { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; } $status = install_plugin_install_status($plugin); $install_status = !empty($status['status']) ? $status['status'] : 'install'; $install_url = !empty($status['url']) ? $status['url'] : null; $install_file = !empty($status['file']) ? $status['file'] : null; $more_details_link = add_query_arg(array('tab' => 'plugin-information', 'plugin' => urlencode($plugin['slug']), 'TB_iframe' => 'true', 'width' => 600, 'height' => 550), self_admin_url('plugin-install.php')); ?> <div class="plugin-card plugin-card-<?php echo esc_attr($plugin['slug']); ?> "> <div class="plugin-card-top"> <div class="name column-name"> <h3> <?php if ($plugin['plugins_api']) { ?> <a href="<?php echo esc_url($more_details_link); ?> " class="thickbox" aria-label="<?php esc_attr_e(sprintf(__('More information about %s'), $plugin['name'])); ?> " data-title="<?php echo esc_attr($plugin['name']); ?> "> <?php } ?> <?php echo esc_html($plugin['name']); ?> <img src="<?php echo esc_url($plugin['icon']); ?> " class="plugin-icon" alt=""> <?php if ($plugin['plugins_api']) { ?> </a> <?php } ?> </h3> </div> <div class="action-links"> <ul class="plugin-action-buttons"> <?php if ($plugin['plugins_api'] && 'install' === $install_status && $install_url) { ?> <li><a class="install-now button" href="<?php echo esc_url($install_url); ?> " data-slug="<?php echo esc_attr($plugin['slug']); ?> " data-name="<?php echo esc_attr($plugin['name']); ?> " aria-label="<?php esc_attr_e(sprintf(__('Install %s now'), $plugin['name'])); ?> "><?php _e('Install Now'); ?> </a></li> <?php } elseif ($plugin['plugins_api'] && 'update_available' === $install_status && $install_url) { ?> <li><a class="update-now button" href="<?php echo esc_url($install_url); ?> " data-plugin="<?php echo esc_attr($install_file); ?> " data-slug="<?php echo esc_attr($plugin['slug']); ?> " data-name="<?php echo esc_attr($plugin['name']); ?> " aria-label="<?php esc_attr_e(sprintf(__('Update %s now'), $plugin['name'])); ?> "><?php _e('Update Now'); ?> </a></li> <?php } elseif (false !== strpos($install_status, '_installed')) { ?> <li><span class="button button-disabled" title="<?php esc_attr_e('This plugin is already installed and is up to date'); ?> "><?php _ex('Installed', 'plugin'); ?> </span></li> <?php } ?> <?php if (!$plugin['plugins_api']) { ?> <li><a href="<?php echo esc_url($plugin['homepage']); ?> " target="_blank"><span class="dashicons dashicons-external"></span> <?php _e('Learn More', 'gd_system'); ?> </a></li> <?php } ?> </ul> </div> <div class="desc column-description"> <p><?php echo esc_html($plugin['short_description']); ?> </p> <p class="authors"> <cite><?php printf(__('By %s'), wp_kses_post($plugin['author'])); ?> </cite> </p> </div> </div> </div> <?php } ?> </div> </div> </div> <?php }
function learn_press_get_add_on_action_link($plugin, $file) { $action_links = array(); if (current_user_can('install_plugins') || current_user_can('update_plugins')) { $name = ''; if (!empty($plugin['source']) && $plugin['source'] == 'wp') { $status = install_plugin_install_status($plugin); switch ($status['status']) { case 'install': if ($status['url']) { /* translators: 1: Plugin name and version. */ $action_links[] = '<a class="install-now button" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Install %s now'), $name)) . '" data-name="' . esc_attr($name) . '"><span>' . __('Install Now') . '</span></a>'; } break; case 'update_available': if ($status['url']) { /* translators: 1: Plugin name and version */ $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr($status['file']) . '" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '" data-name="' . esc_attr($name) . '"><span>' . __('Update Now') . '</span></a>'; } break; case 'latest_installed': case 'newer_installed': $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>'; break; } if (learn_press_is_plugin_install($file)) { if (is_plugin_active($file)) { $action_links[] = '<a class="button disable-now" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url(wp_nonce_url('plugins.php?action=deactivate&plugin=' . $file, 'deactivate-plugin_' . $file)) . '" aria-label="' . esc_attr(sprintf(__('Disable %s now'), $name)) . '" data-name="' . esc_attr($name) . '"><span>' . __('Disable Now', 'learn_press') . '</span></a>'; } else { $action_links[] = '<a class="button enable-now" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url(wp_nonce_url('plugins.php?action=activate&plugin=' . $file, 'activate-plugin_' . $file)) . '" aria-label="' . esc_attr(sprintf(__('Enable %s now'), $name)) . '" data-name="' . esc_attr($name) . '"><span>' . __('Enable Now', 'learn_press') . '</span></a>'; } } } else { if (learn_press_is_plugin_install($file)) { if (is_plugin_active($file)) { $action_links[] = '<a class="button disable-now" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url(wp_nonce_url('plugins.php?action=deactivate&plugin=' . $file, 'deactivate-plugin_' . $file)) . '" aria-label="' . esc_attr(sprintf(__('Disable %s now'), $name)) . '" data-name="' . esc_attr($name) . '"><span>' . __('Disable Now', 'learn_press') . '</span></a>'; } else { $action_links[] = '<a class="button enable-now" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url(wp_nonce_url('plugins.php?action=activate&plugin=' . $file, 'activate-plugin_' . $file)) . '" aria-label="' . esc_attr(sprintf(__('Enable %s now'), $name)) . '" data-name="' . esc_attr($name) . '"><span>' . __('Enable Now', 'learn_press') . '</span></a>'; } } else { if ($plugin['url']) { $action_links[] = '<a class="buy-now button" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($plugin['url']) . '" aria-label="' . esc_attr(sprintf(__('Buy %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Buy Now') . '</a>'; } } } //$action_links[] = $file; } return $action_links; }
protected function install_from_repo($slug, $assoc_args) { $api = plugins_api('plugin_information', array('slug' => $slug)); if (is_wp_error($api)) { if (null === maybe_unserialize($api->get_error_data())) { WP_CLI::error("Can't find the plugin in the WordPress.org repository."); } else { WP_CLI::error($api); } } if (isset($assoc_args['version'])) { list($link) = explode($slug, $api->download_link); if ('dev' == $assoc_args['version']) { $api->download_link = $link . $slug . '.zip'; $api->version = 'Development Version'; } else { $api->download_link = $link . $slug . '.' . $assoc_args['version'] . '.zip'; $api->version = $assoc_args['version']; // check if the requested version exists $response = wp_remote_head($api->download_link); if (!$response || $response['headers']['content-type'] != 'application/octet-stream') { WP_CLI::error("Can't find the requested plugin's version " . $assoc_args['version'] . " in the WordPress.org plugins repository."); } } } $status = install_plugin_install_status($api); WP_CLI::line(sprintf('Installing %s (%s)', $api->name, $api->version)); switch ($status['status']) { case 'update_available': case 'install': $upgrader = WP_CLI\Utils\get_upgrader($this->upgrader); $result = $upgrader->install($api->download_link); if ($result && isset($assoc_args['activate'])) { WP_CLI::line("Activating '{$slug}'..."); $this->activate(array($slug)); } break; case 'newer_installed': WP_CLI::error(sprintf('Newer version (%s) installed.', $status['version'])); break; case 'latest_installed': WP_CLI::error('Latest version already installed.'); break; } }
/** * Install a new plugin * * @param array $args * @param array $assoc_args */ function install($args, $assoc_args) { if (empty($args)) { WP_CLI::line("usage: wp plugin install <plugin-name>"); exit; } $slug = stripslashes($args[0]); // Force WordPress to update the plugin list wp_update_plugins(); $api = plugins_api('plugin_information', array('slug' => $slug)); if (!$api) { WP_CLI::error('Can\'t find the plugin in the WordPress.org plugins repository.'); exit; } if (isset($assoc_args['dev'])) { list($link) = explode($slug, $api->download_link); $api->download_link = $link . $slug . '.zip'; $api->version = 'Development Version'; } $status = install_plugin_install_status($api); WP_CLI::line(sprintf('Installing %s (%s)', $api->name, $api->version)); switch ($status['status']) { case 'update_available': case 'install': $upgrader = WP_CLI::get_upgrader('Plugin_Upgrader'); $result = $upgrader->install($api->download_link); if ($result) { if (isset($assoc_args['activate'])) { system("wp plugin activate " . WP_CLI::compose_args($args, $assoc_args)); } } break; case 'newer_installed': WP_CLI::error(sprintf('Newer version (%s) installed', $status['version'])); break; case 'latest_installed': WP_CLI::error('Latest version already installed'); break; } }
esc_html_e($plugin->purchasedate); ?> </td> <?php /* <td> <?php if ($plugin->isactive) : ?> <?php esc_html_e('Yes', 'plugpress') ?> <?php else: ?> <span class="plugpress-red plugpress-bold"><?php esc_html_e('No', 'plugpress') ?></span> <?php endif; ?> </td> */ ?> <?php $status = install_plugin_install_status($plugin, true); $action = ''; switch ($status['status']) { case 'install': if ($status['url']) { $action = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Install %s', 'plugpress'), $name)) . '">' . __('Install Now', 'plugpress') . '</a>'; } else { $action = '<span title="' . esc_attr__('This plugin is already installed and is up to date', 'plugpress') . ' ">' . __('Installed') . '</span>'; } break; case 'update_available': if ($status['url']) { $action = '<a href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Update to version %s', 'plugpress'), $status['version'])) . '" class="plugpress-bold plugpress-orange">' . sprintf(__('Update Now', 'plugpress'), $status['version']) . '</a>'; } break; case 'latest_installed':
/** * @author Vova Feldman (@svovaf) * @since 1.1.7 * * @param object $api * @param FS_Plugin_Plan|null $plan * * @return string */ private function get_plugin_cta($api, $plan = null) { if (current_user_can('install_plugins') || current_user_can('update_plugins')) { if (!empty($api->checkout_link) && isset($api->plans) && 0 < is_array($api->plans)) { if (is_null($plan)) { $plan = $api->plans[0]; } return ' <a class="button button-primary right" href="' . $this->_fs->addon_checkout_url($plan->plugin_id, $plan->pricing[0]->id, $this->get_billing_cycle($plan), $plan->has_trial()) . '" target="_parent">' . (!$plan->has_trial() ? __fs('purchase', $api->slug) : sprintf(__fs('start-free-x', $api->slug), $this->get_trial_period($plan))) . '</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); // Hosted on WordPress.org. switch ($status['status']) { case 'install': if ($api->external && $this->_fs->is_org_repo_compliant() || !$this->_fs->is_premium()) { /** * Add-on hosted on Freemius, not yet installed, and core * plugin is wordpress.org compliant. Therefore, require a download * since installing external plugins is not allowed by the wp.org guidelines. */ return ' <a class="button button-primary right" href="' . esc_url($api->download_link) . '" target="_blank">' . __fs('download-latest', $api->slug) . '</a>'; } else { if ($status['url']) { return '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>'; } } break; case 'update_available': if ($status['url']) { return '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') . '</a>'; } break; case 'newer_installed': return '<a class="button button-primary right disabled">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>'; break; case 'latest_installed': return '<a class="button button-primary right disabled">' . __('Latest Version Installed') . '</a>'; break; } } } } return ''; }
/** * Ajax handler for installing a plugin. * * @since 4.6.0 * * @see Plugin_Upgrader */ function wp_ajax_install_plugin() { check_ajax_referer('updates'); if (empty($_POST['slug'])) { wp_send_json_error(array('slug' => '', 'errorCode' => 'no_plugin_specified', 'errorMessage' => __('No plugin specified.'))); } $status = array('install' => 'plugin', 'slug' => sanitize_key(wp_unslash($_POST['slug']))); if (!current_user_can('install_plugins')) { $status['errorMessage'] = __('Sorry, you are not allowed to install plugins on this site.'); wp_send_json_error($status); } include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $api = plugins_api('plugin_information', array('slug' => sanitize_key(wp_unslash($_POST['slug'])), 'fields' => array('sections' => false))); if (is_wp_error($api)) { $status['errorMessage'] = $api->get_error_message(); wp_send_json_error($status); } $status['pluginName'] = $api->name; $skin = new WP_Ajax_Upgrader_Skin(); $upgrader = new Plugin_Upgrader($skin); $result = $upgrader->install($api->download_link); if (defined('WP_DEBUG') && WP_DEBUG) { $status['debug'] = $skin->get_upgrade_messages(); } if (is_wp_error($result)) { $status['errorCode'] = $result->get_error_code(); $status['errorMessage'] = $result->get_error_message(); wp_send_json_error($status); } elseif (is_wp_error($skin->result)) { $status['errorCode'] = $skin->result->get_error_code(); $status['errorMessage'] = $skin->result->get_error_message(); wp_send_json_error($status); } elseif ($skin->get_errors()->get_error_code()) { $status['errorMessage'] = $skin->get_error_messages(); wp_send_json_error($status); } elseif (is_null($result)) { global $wp_filesystem; $status['errorCode'] = 'unable_to_connect_to_filesystem'; $status['errorMessage'] = __('Unable to connect to the filesystem. Please confirm your credentials.'); // Pass through the error from WP_Filesystem if one was raised. if ($wp_filesystem instanceof WP_Filesystem_Base && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) { $status['errorMessage'] = esc_html($wp_filesystem->errors->get_error_message()); } wp_send_json_error($status); } $install_status = install_plugin_install_status($api); $pagenow = isset($_POST['pagenow']) ? sanitize_key($_POST['pagenow']) : ''; // If install request is coming from import page, do not return network activation link. $plugins_url = 'import' === $pagenow ? admin_url('plugins.php') : network_admin_url('plugins.php'); if (current_user_can('activate_plugins') && is_plugin_inactive($install_status['file'])) { $status['activateUrl'] = add_query_arg(array('_wpnonce' => wp_create_nonce('activate-plugin_' . $install_status['file']), 'action' => 'activate', 'plugin' => $install_status['file']), $plugins_url); } if (is_multisite() && current_user_can('manage_network_plugins') && 'import' !== $pagenow) { $status['activateUrl'] = add_query_arg(array('networkwide' => 1), $status['activateUrl']); } wp_send_json_success($status); }
public static function install_plugin_install_status($api, $loop = false) { $keyCache = self::hashKey(array('PluginManager_install_plugin_install_status', $api, $loop)); if (!isset(self::$_tempData[$keyCache])) { self::$_tempData[$keyCache] = PepVN_Data::$cacheObject->get_cache($keyCache); if (null === self::$_tempData[$keyCache]) { self::init_require_functions(); self::$_tempData[$keyCache] = install_plugin_install_status($api, $loop); PepVN_Data::$cacheObject->set_cache($keyCache, self::$_tempData[$keyCache]); } } return self::$_tempData[$keyCache]; }
protected function install_from_repo($slug, $assoc_args) { $api = plugins_api('plugin_information', array('slug' => $slug)); if (is_wp_error($api)) { return $api; } if (isset($assoc_args['version'])) { self::alter_api_response($api, $assoc_args['version']); } $status = install_plugin_install_status($api); if (!\WP_CLI\Utils\get_flag_value($assoc_args, 'force') && 'install' != $status['status']) { // We know this will fail, so avoid a needless download of the package. return new WP_Error('already_installed', 'Plugin already installed.'); } WP_CLI::log(sprintf('Installing %s (%s)', html_entity_decode($api->name, ENT_QUOTES), $api->version)); if (\WP_CLI\Utils\get_flag_value($assoc_args, 'version') != 'dev') { WP_CLI::get_http_cache_manager()->whitelist_package($api->download_link, $this->item_type, $api->slug, $api->version); } $result = $this->get_upgrader($assoc_args)->install($api->download_link); return $result; }
/** * Install a new plugin * * @param array $args * @param array $assoc_args */ function install($args, $assoc_args) { if (empty($args)) { WP_CLI::line("usage: wp plugin install <plugin-name>"); exit; } $name = $args[0]; // Force WordPress to update the plugin list wp_update_plugins(); // Get plugin info from the WordPress servers $api = plugins_api('plugin_information', array('slug' => stripslashes($name))); if (!$api) { WP_CLI::error('Can\'t find the plugin in the WordPress.org plugins repository.'); exit; } $status = install_plugin_install_status($api); WP_CLI::line('Installing ' . $api->name . ' (' . $api->version . ')'); // Check what to do switch ($status['status']) { case 'update_available': case 'install': if (!class_exists('Plugin_Upgrader')) { require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; } // Install the plugin ob_start('strip_tags'); $upgrader = new Plugin_Upgrader(new CLI_Upgrader_Skin()); $result = $upgrader->install($api->download_link); $feedback = ob_get_clean(); if ($result) { WP_CLI::line(); WP_CLI::line(strip_tags(str_replace(array('…', 'Plugin installed successfully.'), array("...\n", ''), html_entity_decode($feedback)))); WP_CLI::success('The plugin is successfully installed'); if (isset($assoc_args['activate'])) { system("wp plugin activate " . WP_CLI::compose_args($args, $assoc_args)); } } break; case 'newer_installed': WP_CLI::error(sprintf('Newer version ( %s ) installed', $status['version'])); break; case 'latest_installed': WP_CLI::error('Latest version already installed'); break; } }
echo '<p>' . __('The Following Players are currently supported and can be used with Your Secure Stream, each is a Wordpress Plugin', 'yss') . '</p>'; //echo '<p>' . __('We do not directly use the plugin, but its easier to manage the Flash Player files', 'yss') . '</p>'; echo '<p>' . __('YSS does not support non FLV files in a streaming distribution under FlowPlayer. It just does not work!', 'yss') . '</p>'; // player install include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; global $yss_plugins; $players = array(); echo '<ul>'; foreach ($yss_plugins as $nicename => $data) { $name = $data['name']; $slug = $data['slug']; $action_links = array(); $action_links[] = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=' . $slug . '&TB_iframe=true&width=600&height=550') . '" class="thickbox" title="' . esc_attr(sprintf(__('More information about %s'), $name)) . '">' . __('Details') . '</a>'; if (current_user_can('install_plugins') || current_user_can('update_plugins')) { $api = plugins_api('plugin_information', $data); $status = install_plugin_install_status($api); $context = $status; switch ($status['status']) { case 'install': if ($status['url']) { $action_links[] = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Install %s'), $name)) . '">' . __('Install Now') . '</a>'; } break; case 'update_available': if ($status['url']) { $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Update to version %s'), $status['version'])) . '">' . sprintf(__('Update Now'), $status['version']) . '</a>'; } break; case 'latest_installed': case 'newer_installed': $action_links[] = '<span title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . __('Installed') . '</span>';
function ewic_free_plugin_page() { include ABSPATH . "wp-admin/includes/plugin-install.php"; global $tabs, $tab, $paged, $type, $term; $tabs = array(); $tab = "search"; $per_page = 30; $args = array("author" => "GhozyLab", "page" => $paged, "per_page" => $per_page, "fields" => array("last_updated" => true, "downloaded" => true, "icons" => true), "locale" => get_locale()); $args = apply_filters("install_plugins_table_api_args_{$tab}", $args); $api = plugins_api("query_plugins", $args); $item = $api->plugins; $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())); ?> <form id="plugin-filter"> <div class="wrap"> <style> .ewic-plugin-action-buttons { text-align:right; } .ewic-plugin-action-buttons li { display: inline-block; margin-left: 1em; } .ewic-button-con { padding-right: 15px; } .ewic-button-install { background: none repeat scroll 0% 0% #2EA2CC !important; border-color: #0074A2 !important; box-shadow: 0px 1px 0px rgba(120, 200, 230, 0.5) inset, 0px 1px 0px rgba(0, 0, 0, 0.15) !important; color: #FFF !important; } .ewic-button-install:focus { box-shadow: 0px 0px 0px 1px #5B9DD9, 0px 0px 2px 1px rgba(30, 140, 190, 0.8) !important; } .ewic-button-install:hover { color: #FFF !important; background: none repeat scroll 0% 0% #5B9DD9 !important; } .ewic-button-update { background: none repeat scroll 0% 0% #E74F34 !important; border-color: #C52F2F !important; box-shadow: 0px 1px 0px rgba(255, 235, 235, 0.5) inset, 0px 1px 0px rgba(0, 0, 0, 0.15) !important; color: #FFF !important; } .ewic-button-update:focus { box-shadow: 0px 0px 0px 1px #DA3232, 0px 0px 2px 1px rgba(255, 140, 140, 0.8) !important; } .ewic-button-update:hover { color: #FFF !important; background: none repeat scroll 0% 0% #DA3232 !important; } </style> <div style="margin-top:30px;" class="wp-list-table widefat plugin-install"> <div id="the-list"> <?php foreach ((array) $item as $plugin) { if (is_object($plugin)) { $plugin = (array) $plugin; } $title = wp_kses($plugin['name'], $plugins_allowedtags); // Remove any HTML from the description. $description = strip_tags($plugin['short_description']); $version = wp_kses($plugin['version'], $plugins_allowedtags); $name = strip_tags($title . ' ' . $version); $author = wp_kses($plugin['author'], $plugins_allowedtags); if (!empty($author)) { $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>'; } $action_links = array(); if (current_user_can('install_plugins') || current_user_can('update_plugins')) { $status = install_plugin_install_status($plugin); switch ($status['status']) { case 'install': if ($status['url']) { /* translators: 1: Plugin name and version. */ $action_links[] = '<a class="install-now button-secondary ewic-button-install" href="' . $status['url'] . '" aria-label="' . esc_attr(sprintf(__('Install %s now'), $name)) . '">' . __('Install Now') . '</a>'; } break; case 'update_available': if ($status['url']) { /* translators: 1: Plugin name and version */ $action_links[] = '<a class="button ewic-button-update" href="' . $status['url'] . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '">' . __('Update Now') . '</a>'; } break; case 'latest_installed': case 'newer_installed': $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>'; break; } } $details_link = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=600&height=550'); /* translators: 1: Plugin name and version. */ $action_links[] = '<a href="' . esc_url($details_link) . '" class="thickbox" aria-label="' . esc_attr(sprintf(__('More information about %s'), $name)) . '" data-title="' . esc_attr($name) . '">' . __('More Details') . '</a>'; if (!empty($plugin['icons']['svg'])) { $plugin_icon_url = $plugin['icons']['svg']; } elseif (!empty($plugin['icons']['2x'])) { $plugin_icon_url = $plugin['icons']['2x']; } elseif (!empty($plugin['icons']['1x'])) { $plugin_icon_url = $plugin['icons']['1x']; } else { $plugin_icon_url = $plugin['icons']['default']; } /** * Filter the install action links for a plugin. * * @since 2.7.0 * * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now. * @param array $plugin The plugin currently being listed. */ $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin); ?> <div class="plugin-card"> <div class="plugin-card-top" style="min-height: 160px !important;"> <a href="<?php echo esc_url($details_link); ?> " class="thickbox plugin-icon"><img src="<?php echo esc_attr($plugin_icon_url); ?> " /></a> <div class="name column-name" style="margin-right: 20px !important;"> <h4><a href="<?php echo esc_url($details_link); ?> " class="thickbox"><?php echo $title; ?> </a></h4> </div> <div class="desc column-description" style="margin-right: 20px !important;"> <p><?php echo $description; ?> </p> <p class="authors"><?php echo $author; ?> </p> </div> </div> <div class="ewic-button-con"> <?php if ($action_links) { echo '<ul class="ewic-plugin-action-buttons">'; echo '<li>' . $action_links[0] . '</li>'; switch ($plugin["slug"]) { case "easy-media-gallery": echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://ghozylab.com/plugins/easy-media-gallery-pro/demo/" target="_blank">PRO VERSION DEMO</a></li>'; break; case "image-slider-widget": echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://demo.ghozylab.com/plugins/easy-image-slider-plugin/image-slider-with-thumbnails-at-the-bottom/" target="_blank">PRO VERSION DEMO</a></li>'; break; case "easy-notify-lite": echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://ghozylab.com/plugins/easy-notify-pro/demo/" target="_blank">PRO VERSION DEMO</a></li>'; break; case "contact-form-lite": echo '<li><a class="button" aria-label="PRO VERSION DEMO" href="http://demo.ghozylab.com/plugins/easy-contact-form-plugin/contact-form-recaptcha/" target="_blank">PRO VERSION DEMO</a></li>'; break; default: break; } echo '</ul>'; } ?> </div> <div class="plugin-card-bottom"> <div class="vers column-rating"> <?php wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'])); ?> <span class="num-ratings">(<?php echo number_format_i18n($plugin['num_ratings']); ?> )</span> </div> <div class="column-updated"> <strong><?php _e('Last Updated:'); ?> </strong> <span title="<?php echo esc_attr($plugin['last_updated']); ?> "> <?php printf(__('%s ago'), human_time_diff(strtotime($plugin['last_updated']))); ?> </span> </div> <div class="column-downloaded"> <?php echo sprintf(_n('%s download', '%s downloads', $plugin['downloaded']), number_format_i18n($plugin['downloaded'])); ?> </div> <div class="column-compatibility"> <?php if (!empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) { echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>'; } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) { echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>'; } else { echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>'; } ?> </div> </div> </div> <?php } ?> </div> </div> </div> </form> <?php }
function hocwp_plugin_install_status($plugin) { if (!function_exists('install_plugin_install_status')) { require ABSPATH . 'wp-admin/includes/plugin-install.php'; } return install_plugin_install_status($plugin); }
function buddyforms_get_addons($call_api) { ?> <div class="col-12" itemscope="" itemtype="http://schema.org/SoftwareApplication"> <p style="text-align: right"><strong style="float: left"> Showing <?php echo count($call_api->plugins) + 1; ?> Extensions </strong> <br class="clear"></p> <div class="plugin-group"> <?php foreach ($call_api->plugins as $plugin) { $plugin = (array) $plugin; $date_format = __('M j, Y @ H:i'); $last_updated_timestamp = strtotime($plugin['last_updated']); $details_link = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=772&height=600'); if (!empty($plugin['icons']['svg'])) { $plugin_icon_url = $plugin['icons']['svg']; } elseif (!empty($plugin['icons']['2x'])) { $plugin_icon_url = $plugin['icons']['2x']; } elseif (!empty($plugin['icons']['1x'])) { $plugin_icon_url = $plugin['icons']['1x']; } else { $plugin_icon_url = $plugin['icons']['default']; } $action_links = array(); // Remove any HTML from the description. $description = strip_tags($plugin['short_description']); $version = $plugin['version']; $title = $plugin['name']; $name = strip_tags($title . ' ' . $version); $author = $plugin['author']; if (!empty($author)) { $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>'; } if (current_user_can('install_plugins') || current_user_can('update_plugins')) { $status = install_plugin_install_status($plugin); //echo $status['status']; //echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . sanitize_html_class( $plugin['slug'] )), 'install-plugin_' . sanitize_html_class( $plugin['slug'] )); switch ($status['status']) { case 'install': if ($status['url']) { /* translators: 1: Plugin name and version. */ $action_links[] = '<a class="install-now button" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Install %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Install Now') . '</a>'; } break; case 'update_available': if ($status['url']) { /* translators: 1: Plugin name and version */ $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr($status['file']) . '" data-slug="' . esc_attr($plugin['slug']) . '" href="' . esc_url($status['url']) . '" aria-label="' . esc_attr(sprintf(__('Update %s now'), $name)) . '" data-name="' . esc_attr($name) . '">' . __('Update Now') . '</a>'; } break; case 'latest_installed': case 'newer_installed': //$action_links[] = '<a class="activate-now button" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . sanitize_html_class( $plugin['slug'] )), 'install-plugin_' . sanitize_html_class( $plugin['slug'] )) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Update Now' ) . '</a>'; $action_links[] = '<span class="button button-disabled" title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>'; break; } } ?> <div class="plugin-card plugin-card-<?php echo sanitize_html_class($plugin['slug']); ?> "> <div class="plugin-card-top"> <a href="<?php echo esc_url($details_link); ?> " class="thickbox plugin-icon"><img src="<?php echo esc_attr($plugin_icon_url); ?> " /></a> <div class="name column-name"> <h4><a href="<?php echo esc_url($details_link); ?> " class="thickbox"><?php echo $plugin['name']; ?> </a></h4> </div> <div class="action-links"> <?php if ($action_links) { echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>'; } ?> </div> <div class="desc column-description"> <p><?php echo $description; ?> </p> <p class="authors"><?php echo $author; ?> </p> </div> </div> <div class="plugin-card-bottom"> <div class="vers column-rating"> <?php wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'])); ?> <span class="num-ratings">(<?php echo number_format_i18n($plugin['num_ratings']); ?> )</span> </div> <div class="column-updated"> <strong><?php _e('Last Updated:'); ?> </strong> <span title="<?php echo esc_attr(date_i18n($date_format, $last_updated_timestamp)); ?> "> <?php printf(__('%s ago'), human_time_diff($last_updated_timestamp)); ?> </span> </div> <div class="column-downloaded"> <?php if ($plugin['active_installs'] >= 1000000) { $active_installs_text = _x('1+ Million', 'Active plugin installs'); } else { $active_installs_text = number_format_i18n($plugin['active_installs']) . '+'; } printf(__('%s Active Installs'), $active_installs_text); ?> </div> <div class="column-compatibility"> <?php if (!empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) { echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>'; } elseif (!empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) { echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>'; } else { echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>'; } ?> </div> </div> </div> <?php } ?> </div> </div> <?php }
$plugin_icon_url = $plugin["icons"]["1x"]; } else { $plugin_icon_url = $plugin["icons"]["default"]; } $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(), "ul" => array(), "ol" => array(), "li" => array(), "p" => array(), "br" => array()); $title = wp_kses($plugin["name"], $plugins_allowedtags); $description = strip_tags($plugin["short_description"]); $author = wp_kses($plugin["author"], $plugins_allowedtags); $version = wp_kses($plugin["version"], $plugins_allowedtags); $name = strip_tags($title . " " . $version); $details_link = self_admin_url("plugin-install.php?tab=plugin-information&plugin=" . $plugin["slug"] . "&TB_iframe=true&width=600&height=550"); /* translators: 1: Plugin name and version. */ $action_links[] = '<a href="' . esc_url($details_link) . '" class="thickbox" aria-label="' . esc_attr(sprintf("More information about %s", $name)) . '" data-title="' . esc_attr($name) . '">' . __('More Details') . '</a>'; $action_links = array(); if (current_user_can("install_plugins") || current_user_can("update_plugins")) { $status = install_plugin_install_status($plugin); switch ($status["status"]) { case "install": if ($status["url"]) { /* translators: 1: Plugin name and version. */ $action_links[] = '<a class="install-now button" href="' . $status['url'] . '" aria-label="' . esc_attr(sprintf("Install %s now", $name)) . '">' . __('Install Now') . '</a>'; } break; case "update_available": if ($status["url"]) { /* translators: 1: Plugin name and version */ $action_links[] = '<a class="button" href="' . $status['url'] . '" aria-label="' . esc_attr(sprintf("Update %s now", $name)) . '">' . __('Update Now') . '</a>'; } break; case "latest_installed": case "newer_installed":
/** * Prints the Plugin box for the given plugin * * @since 4.0 * * @param string $plugin Plugin Name key * @return void */ public function print_plugin_box($plugin) { $plugin = (object) $this->get_plugins($plugin, false); $api_data = $this->get_plugin_api_data($plugin); $addons = $this->get_addons($plugin->name); $plugins = get_plugins(); if ($api_data) { if (!function_exists('install_plugin_install_status')) { include_once ABSPATH . '/wp-admin/includes/plugin-install.php'; } $status = install_plugin_install_status($api_data); $plugin_active = is_plugin_active($status['file']); $plugin_exists = isset($plugins[$status['file']]); if ('install' !== $status['status'] && !$plugin_active) { $args = array('action' => 'activate', 'plugin' => $status['file'], 'plugin_status' => 'all', 'paged' => 1, 's' => ''); $activate_url = wp_nonce_url(add_query_arg($args, 'plugins.php'), 'activate-plugin_' . $status['file']); $link = '<a class="button" href="' . $activate_url . '" aria-label="' . esc_attr(sprintf(esc_attr__('Activate %s', 'tribe-common'), $plugin->name)) . '">' . esc_html__('Activate Plugin', 'tribe-common') . '</a>'; } elseif ('update_available' === $status['status']) { $args = array('action' => 'upgrade-plugin', 'plugin' => $status['file']); $update_url = wp_nonce_url(add_query_arg($args, 'update.php'), 'upgrade-plugin_' . $status['file']); $link = '<a class="button" href="' . $update_url . '">' . esc_html__('Upgrade Plugin', 'tribe-common') . '</a>'; } elseif ($plugin_exists) { $link = '<a class="button disabled">' . esc_html__('You are up to date!', 'tribe-common') . '</a>'; } } if (!isset($link)) { if ($api_data) { $args = array('tab' => 'plugin-information', 'plugin' => $plugin->name, 'TB_iframe' => true, 'width' => 772, 'height' => 600); $iframe_url = add_query_arg($args, admin_url('/plugin-install.php')); $link = '<a class="button thickbox" href="' . $iframe_url . '" aria-label="' . esc_attr(sprintf(esc_attr__('Install %s', 'tribe-common'), $plugin->name)) . '">' . esc_html__('Install Plugin', 'tribe-common') . '</a>'; } else { $link = null; } } ?> <div class="tribe-help-plugin-info"> <h3><a href="<?php echo esc_url($plugin->repo); ?> "><?php echo esc_html($plugin->title); ?> </a></h3> <?php if (!empty($plugin->description) && !$plugin->is_active) { echo wpautop($plugin->description); } ?> <?php if ($api_data) { ?> <dl> <dt><?php esc_html_e('Latest Version:', 'tribe-common'); ?> </dt> <dd><?php echo esc_html($api_data->version); ?> </dd> <dt><?php esc_html_e('Requires:', 'tribe-common'); ?> </dt> <dd><?php echo esc_html__('WordPress ', 'tribe-common') . esc_html($api_data->requires); ?> +</dd> <dt><?php esc_html_e('Active Users:', 'tribe-common'); ?> </dt> <dd><?php echo esc_html(number_format($api_data->active_installs)); ?> +</dd> <dt><?php esc_html_e('Rating:', 'tribe-common'); ?> </dt> <dd><a href="<?php echo esc_url($plugin->stars_url); ?> " target="_blank"> <?php wp_star_rating(array('rating' => $api_data->rating, 'type' => 'percent', 'number' => $api_data->num_ratings)); ?> </a></dd> </dl> <?php } ?> <?php // Only show the link to the users can use it if (current_user_can('update_plugins') && current_user_can('install_plugins')) { echo $link ? '<p style="text-align: center;">' . $link . '</p>' : ''; } ?> <?php if (!empty($addons)) { ?> <h3><?php esc_html_e('Premium Add-Ons', 'tribe-common'); ?> </h3> <ul class='tribe-list-addons'> <?php foreach ($addons as $addon) { $addon = (object) $addon; if (isset($addon->is_active) && $addon->is_active) { $active_title = __('Plugin Active', 'tribe-common'); } else { $active_title = __('Plugin Inactive', 'tribe-common'); } echo '<li title="' . esc_attr($active_title) . '" class="' . (isset($addon->is_active) && $addon->is_active ? 'tribe-active-addon' : '') . '">'; if (isset($addon->link)) { echo '<a href="' . esc_url($addon->link) . '" title="' . esc_attr__('Visit the Add-on Page', 'tribe-common') . '" target="_blank">'; } echo esc_html($addon->title); if (isset($addon->link)) { echo '</a>'; } echo '</li>'; } ?> </ul> <?php } ?> </div> <?php }
function display_rows() { $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(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array()); list($columns, $hidden) = $this->get_column_info(); $style = array(); foreach ($columns as $column_name => $column_display_name) { $style[$column_name] = in_array($column_name, $hidden) ? 'style="display:none;"' : ''; } foreach ((array) $this->items as $plugin) { if (is_object($plugin)) { $plugin = (array) $plugin; } $title = wp_kses($plugin['name'], $plugins_allowedtags); //Limit description to 400char, and remove any HTML. $description = strip_tags($plugin['description']); if (strlen($description) > 400) { $description = mb_substr($description, 0, 400) . '…'; } //remove any trailing entities $description = preg_replace('/&[^;\\s]{0,6}$/', '', $description); //strip leading/trailing & multiple consecutive lines $description = trim($description); $description = preg_replace("|(\r?\n)+|", "\n", $description); //\n => <br> $description = nl2br($description); $version = wp_kses($plugin['version'], $plugins_allowedtags); $name = strip_tags($title . ' ' . $version); $author = $plugin['author']; if (!empty($plugin['author'])) { $author = ' <cite>' . sprintf(__('By %s'), $author) . '.</cite>'; } $author = wp_kses($author, $plugins_allowedtags); $action_links = array(); $action_links[] = '<a href="' . self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=600&height=550') . '" class="thickbox" title="' . esc_attr(sprintf(__('More information about %s'), $name)) . '">' . __('Details') . '</a>'; if (current_user_can('install_plugins') || current_user_can('update_plugins')) { $status = install_plugin_install_status($plugin); switch ($status['status']) { case 'install': if ($status['url']) { $action_links[] = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Install %s'), $name)) . '">' . __('Install Now') . '</a>'; } break; case 'update_available': if ($status['url']) { $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr(sprintf(__('Update to version %s'), $status['version'])) . '">' . sprintf(__('Update Now'), $status['version']) . '</a>'; } break; case 'latest_installed': case 'newer_installed': $action_links[] = '<span title="' . esc_attr__('This plugin is already installed and is up to date') . ' ">' . _x('Installed', 'plugin') . '</span>'; break; } } $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin); ?> <tr> <td class="name column-name"<?php echo $style['name']; ?> ><strong><?php echo $title; ?> </strong> <div class="action-links"><?php if (!empty($action_links)) { echo implode(' | ', $action_links); } ?> </div> </td> <td class="vers column-version"<?php echo $style['version']; ?> ><?php echo $version; ?> </td> <td class="vers column-rating"<?php echo $style['rating']; ?> > <div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $plugin['num_ratings']), number_format_i18n($plugin['num_ratings'])); ?> "> <div class="star star-rating" style="width: <?php echo esc_attr(str_replace(',', '.', $plugin['rating'])); ?> px"></div> </div> </td> <td class="desc column-description"<?php echo $style['description']; ?> ><?php echo $description, $author; ?> </td> </tr> <?php } }
protected function create_plugin_list() { if (isset($_GET['action'])) { if ($_GET['action'] == 'activate') { if (isset($_GET['plugin'])) { activate_plugin($_GET['plugin'] . '/' . $_GET['plugin'] . '.php'); // echo '<script type="text/javascript">window.location="' . WPFront_Static::self_admin_url('admin.php?page=' . self::MENU_SLUG) . '";</script>'; // wp_die(); // return; } } } $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(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array()); if (!function_exists('plugins_api')) { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; } add_thickbox(); $args = array(); $args['page'] = 1; $args['per_page'] = 30; $args['author'] = 'syammohanm'; $api = plugins_api('query_plugins', $args); if (is_wp_error($api)) { wp_die($this->__('Unable to communicate with WordPress.org')); return; } ?> <style type="text/css"> div.wpfront-container table.plugins { margin-top: 16px; margin-bottom: 16px; } div.wpfront-container table.plugins th.check-column { width: 0px; } div.wpfront-container div.footer { text-align: center; } </style> <?php echo '<div class="wrap wpfront-container">'; echo '<h2>' . $this->__('WPFront Plugins') . '</h2>'; echo '<table class="wp-list-table widefat plugins plugin-install">'; $this->print_column_headers(); foreach ((array) $api->plugins as $plugin) { if (is_object($plugin)) { $plugin = (array) $plugin; } $title = wp_kses($plugin['name'], $plugins_allowedtags); $description = strip_tags($plugin['description']); if (strlen($description) > 400) { $description = mb_substr($description, 0, 400) . '…'; } //remove any trailing entities $description = preg_replace('/&[^;\\s]{0,6}$/', '', $description); //strip leading/trailing & multiple consecutive lines $description = trim($description); $description = preg_replace("|(\r?\n)+|", "\n", $description); //\n => <br> $description = nl2br($description); $version = wp_kses($plugin['version'], $plugins_allowedtags); $name = strip_tags($title . ' ' . $version); $author = $plugin['author']; if (!empty($plugin['author'])) { $author = ' <cite>' . sprintf($this->__('By %s'), $author) . '.</cite>'; } $author = wp_kses($author, $plugins_allowedtags); $action_links = array(); $action_links[] = '<a href="' . WPFront_Static::self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . '&TB_iframe=true&width=600&height=550') . '" class="thickbox" title="' . esc_attr(sprintf($this->__('More information about %s'), $name)) . '">' . $this->__('Details') . '</a>'; $class = 'inactive'; if (current_user_can('install_plugins') || current_user_can('update_plugins')) { $status = install_plugin_install_status($plugin); switch ($status['status']) { case 'install': if ($status['url']) { $action_links[] = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr(sprintf($this->__('Install %s'), $name)) . '">' . $this->__('Install Now') . '</a>'; } $class = 'active'; break; case 'update_available': if ($status['url']) { $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr(sprintf($this->__('Update to version %s'), $status['version'])) . '">' . sprintf($this->__('Update Now'), $status['version']) . '</a>'; } $class = 'active update'; break; case 'latest_installed': case 'newer_installed': $action_links[] = '<span title="' . esc_attr__($this->__('This plugin is already installed and is up to date')) . ' ">' . $this->__('Installed') . '</span>'; if (is_plugin_active($plugin['slug'] . '/' . $plugin['slug'] . '.php')) { $action_links[] = '<a href="' . WPFront_Static::self_admin_url('admin.php?page=' . $plugin['slug']) . '">' . $this->__('Settings') . '</a>'; } else { $action_links[] = '<a href="' . WPFront_Static::self_admin_url('admin.php?page=' . self::MENU_SLUG . '&action=activate&plugin=' . $plugin['slug']) . '">' . $this->__('Activate') . '</a>'; } break; } } $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin); ?> <tr class="<?php echo $class; ?> "> <th class="check-column"></th> <td class="name column-name"><strong><?php echo $title; ?> </strong> <div class="action-links"><?php if (!empty($action_links)) { echo implode(' | ', $action_links); } ?> </div> </td> <td class="vers column-version"><?php echo $version; ?> </td> <td class="vers column-rating"> <?php $this->wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'])); ?> </td> <td class="desc column-description"><?php echo $description, $author; ?> </td> </tr> <?php } $this->print_column_footers(); echo '</table>'; echo '<div class="footer"><a href="http://wpfront.com/contact" target="_blank">' . $this->__('Feedback') . '</a> | <a href="http://wpfront.com" target="_blank">wpfront.com</a></div>'; echo '</div>'; }
/** * 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; }
/** * Determine the status we can perform on a plugin. * * @since 3.0.0 */ function _install_plugin_install_status($api, $loop = false) { // This function is called recursively, $loop prevents further loops. if (is_array($api)) { $api = (object) $api; } // Default to a "new" plugin $status = 'install'; $url = false; $update_file = false; /* * Check to see if this plugin is known to be installed, * and has an update awaiting it. */ $update_plugins = get_site_transient('update_plugins'); if (isset($update_plugins->response)) { foreach ((array) $update_plugins->response as $file => $plugin) { if ($plugin->slug === $api->slug) { $status = 'update_available'; $update_file = $file; $version = $plugin->new_version; if (current_user_can('update_plugins')) { $url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file); } break; } } } if ('install' == $status) { if (is_dir(WP_PLUGIN_DIR . '/' . $api->slug)) { $installed_plugin = get_plugins('/' . $api->slug); if (empty($installed_plugin)) { if (current_user_can('install_plugins')) { $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug); } } else { $key = array_keys($installed_plugin); $key = reset($key); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers $update_file = $api->slug . '/' . $key; if (version_compare($api->version, $installed_plugin[$key]['Version'], '=')) { $status = 'latest_installed'; } elseif (version_compare($api->version, $installed_plugin[$key]['Version'], '<')) { $status = 'newer_installed'; $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 if (!$loop) { delete_site_transient('update_plugins'); wp_update_plugins(); return install_plugin_install_status($api, true); } } } } else { // "install" & no directory with that slug if (current_user_can('install_plugins')) { $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug); } } } if (isset($_GET['from'])) { $url .= '&from=' . urlencode(wp_unslash($_GET['from'])); } $file = $update_file; return compact('status', 'url', 'version', 'file'); }