WordPress.org

Plugin Directory

Changeset 604157


Ignore:
Timestamp:
09/26/12 14:06:24 (19 months ago)
Author:
japh
Message:

Removing bad karma

Location:
favorite-plugins/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • favorite-plugins/trunk/favorite-plugins.php

    r604128 r604157  
    44Plugin URI: http://japh.wordpress.com/plugins/favorite-plugins 
    55Description: Quickly and easily access and install your favorited plugins from WordPress.org, right from your dashboard. 
    6 Version: 0.3 
     6Version: 0.4 
    77Author: Japh 
    88Author URI: http://japh.wordpress.com 
     
    3636 * @copyright 2012 Japh 
    3737 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt GPL2 
    38  * @version 0.3 
     38 * @version 0.4 
    3939 * @link http://japh.wordpress.com/plugins/favorite-plugins 
    4040 * @since 0.1 
     
    6262 * @copyright 2012 Japh 
    6363 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt GPL2 
    64  * @version 0.3 
     64 * @version 0.4 
    6565 * @since 0.1 
    6666 */ 
    6767class Japh_Favorite_Plugins { 
    6868 
    69     public $version = '0.3'; 
     69    public $version = '0.4'; 
    7070    public $username = null; 
    7171    public $favorite_plugins = null; 
     
    215215     */ 
    216216    function fetch_favorites() { 
    217  
    218         $favorites_url = 'http://profiles.wordpress.org/' . $this->username; 
    219         $favorites_html = wp_remote_get( esc_url( $favorites_url ) ); 
    220  
    221         if ( is_wp_error( $favorites_html ) ) { 
    222             return '-1'; 
    223         } else { 
    224             if ( preg_match( '/(?:<body[^>]*>)(.*)<\/body>/isU', $favorites_html['body'], $matches ) ) { 
    225                 $body = $matches[1]; 
    226             } 
    227  
    228             $favorite_plugins = array(); 
    229  
    230             if ( ! empty( $body ) ) { 
    231                 /** Require the PHP Simple HTML DOM Parser library */ 
    232                 require( JFP_PLUGIN_DIR . 'lib' . DIRECTORY_SEPARATOR . 'simple_html_dom.php' ); 
    233  
    234                 $doc = str_get_html( $body ); 
    235  
    236                 foreach ( $doc->find( 'div.main-plugins' ) as $section ) { 
    237  
    238                     $header = $section->find( 'h4' ); 
    239  
    240                     foreach ( $header as $head ) { 
    241  
    242                         if ( strpos( strtolower( $head->innertext ), strtolower( "favorite plugins" ) ) !== false ) { 
    243  
    244                             $favorites_list = $head->next_sibling(); 
    245  
    246                             foreach ( $favorites_list->children() as $favorite ) { 
    247                                 if ( ! empty( $favorite->plaintext ) ) { 
    248  
    249                                     $a = $favorite->find( 'a' ); 
    250  
    251                                     foreach ( $a as $link ) { 
    252  
    253                                         $new_favorite = array(); 
    254                                         $new_favorite['name'] = $link->innertext; 
    255                                         $new_favorite['url'] = $link->href; 
    256                                         $slug = explode( '/', $link->href ); 
    257                                         $new_favorite['slug'] = $slug[count( $slug ) - 2]; 
    258  
    259                                         $favorite_plugins[$new_favorite['slug']] = $new_favorite; 
    260  
    261                                     } 
    262                                 } 
    263                             } 
    264                         } 
    265                     } 
    266                 } 
    267             } 
    268  
    269             return $favorite_plugins; 
    270         } 
     217        return false; 
    271218    } 
    272219 
  • favorite-plugins/trunk/readme.txt

    r604128 r604157  
    44Requires at least: 3.4 
    55Tested up to: 3.4.2 
    6 Stable tag: 0.3 
     6Stable tag: 0.4 
    77License: GPLv2 or later 
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    1111 
    1212== Description == 
     13 
     14***** Please note, this plugin is currently inoperable until WordPress.org has a Favorites API ***** 
    1315 
    1416This is a simple plugin that adds "Favorites" to the plugin installation screen in WordPress. Simply enter your WordPress.org username (or even someone else's) and see a list of favorite plugins that can be easily installed. 
     
    4244== Changelog == 
    4345 
     46= 0.4 = 
     47* Removed the HTML parsing library and all scraping code from the plugin 
     48* This update stops the plugin from working 
     49 
    4450= 0.3 = 
    4551* The HTML parsing library is now loaded in a more conservative location, so it's only loaded when needed 
Note: See TracChangeset for help on using the changeset viewer.