| 128 | | ?> |
| 129 | | <p><?php printf( __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format via <a href="%2$s">this page</a>.' ), 'https://wordpress.org/plugins/', self_admin_url( 'plugin-install.php?tab=upload' ) ); ?></p> |
| | 128 | ?> |
| | 129 | <div class="tablenav top"> |
| | 130 | <div class="alignleft actions"> |
| | 131 | <?php install_search_form( false ); ?> |
| | 132 | </div> |
| | 133 | </div> |
| | 134 | <div class="plugin-install-wrap"> |
| | 135 | |
| | 136 | <?php install_category_list(); ?> |
| | 137 | |
| | 138 | <div class="top-plugins"> |
| | 139 | <div class="featured-plugins plugins-list"> |
| | 140 | <h4><?php _e( 'Featured plugins' ); ?></h4> |
| | 141 | <?php install_short_plugin_list( 'featured' ); ?> |
| | 142 | </div> |
| | 143 | |
| | 144 | <div class="popular-plugins plugins-list"> |
| | 145 | <h4><?php _e( 'Popular plugins' ); ?></h4> |
| | 146 | <?php install_short_plugin_list( 'popular' ); ?> |
| | 147 | </div> |
| 138 | | $api_tags = install_popular_tags(); |
| | 167 | if ( !$api ) { |
| | 168 | $api = plugins_api( 'query_plugins', array( 'browse' => $type, 'page' => 1, 'per_page' => $limit ) ); |
| | 169 | |
| | 170 | if ( is_wp_error( $api ) ) { |
| | 171 | echo '<p>' . $api->get_error_message() . '</p>'; |
| | 172 | return $api; |
| | 173 | } |
| | 174 | set_site_transient( $key, $api, 3 * HOUR_IN_SECONDS ); |
| | 175 | } |
| | 176 | |
| | 177 | echo '<ul class="'.esc_attr( $type ).'-plugins">'; |
| | 178 | foreach ( $api->plugins as $plugin ) { |
| | 179 | echo '<li>'; |
| | 180 | echo '<a href="' . self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin->slug . |
| | 181 | '&TB_iframe=true&width=600&height=550' ) . '" class="thickbox" title="' . |
| | 182 | esc_attr( sprintf( __( 'More information about %s' ), $plugin->name ) ) . '">' . esc_html( $plugin->name ) . '</a>'; |
| | 183 | echo '</li>'; |
| | 184 | } |
| | 185 | echo '</ul>'; |
| | 186 | } |
| 140 | | echo '<p class="popular-tags">'; |
| 141 | | if ( is_wp_error($api_tags) ) { |
| 142 | | echo $api_tags->get_error_message(); |
| 143 | | } else { |
| 144 | | //Set up the tags in a way which can be interpreted by wp_generate_tag_cloud() |
| 145 | | $tags = array(); |
| 146 | | foreach ( (array)$api_tags as $tag ) |
| 147 | | $tags[ $tag['name'] ] = (object) array( |
| 148 | | 'link' => esc_url( self_admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ), |
| 149 | | 'name' => $tag['name'], |
| 150 | | 'id' => sanitize_title_with_dashes($tag['name']), |
| 151 | | 'count' => $tag['count'] ); |
| 152 | | echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%s plugin'), 'multiple_text' => __('%s plugins') ) ); |
| | 188 | /** |
| | 189 | * Return a list of plugin categories. |
| | 190 | */ |
| | 191 | function install_get_category_list( $args = array() ) { |
| | 192 | $key = md5(serialize($args)); |
| | 193 | if ( false !== ($categories = get_site_transient('plugin_categories_' . $key) ) ) |
| | 194 | return $categories; |
| | 195 | |
| | 196 | $categories = plugins_api('hot_categories', $args); |
| | 197 | |
| | 198 | if ( is_wp_error($categories) ) |
| | 199 | return $categories; |
| | 200 | |
| | 201 | set_site_transient( 'plugin_categories_' . $key, $categories, 3 * HOUR_IN_SECONDS ); |
| | 202 | |
| | 203 | return $categories; |
| | 204 | } |
| | 205 | |
| | 206 | /** |
| | 207 | * Display a list of plugin categories. |
| | 208 | */ |
| | 209 | function install_category_list() { |
| | 210 | |
| | 211 | $categories = install_get_category_list(); |
| | 212 | $categories = array_values( $categories ); |
| | 213 | |
| | 214 | echo '<div class="plugin-categories">'; |
| | 215 | for ( $i=0; $i < 4; $i++ ) { |
| | 216 | echo '<div class="plugin-category-big">'; |
| | 217 | echo '<a href="' . esc_url( self_admin_url('plugin-install.php?tab=search&type=category&s=' . urlencode($categories[$i]['name'])) ) . '">'; |
| | 218 | echo esc_html( $categories[ $i ]['name'] ); |
| | 219 | echo '</a>'; |
| | 220 | echo '</div>'; |
| 190 | | <h4><?php _e('Install a plugin in .zip format'); ?></h4> |
| 191 | | <p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.'); ?></p> |
| 192 | | <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-plugin'); ?>"> |
| 193 | | <?php wp_nonce_field( 'plugin-upload'); ?> |
| 194 | | <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label> |
| 195 | | <input type="file" id="pluginzip" name="pluginzip" /> |
| 196 | | <?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?> |
| 197 | | </form> |
| | 269 | <div class="plugin-install-wrap"> |
| | 270 | <h4><?php _e('Install a plugin in .zip format'); ?></h4> |
| | 271 | <p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.'); ?></p> |
| | 272 | <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-plugin'); ?>"> |
| | 273 | <?php wp_nonce_field( 'plugin-upload'); ?> |
| | 274 | <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label> |
| | 275 | <input type="file" id="pluginzip" name="pluginzip" /> |
| | 276 | <?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?> |
| | 277 | </form> |
| | 278 | </div> |