fetch($url); preg_match_all('#
(.*?)
#ims'; preg_match_all($regex,$mat[2][$i],$matPlugins); for( $j=0; $j < count($matPlugins[1]); $j++){ preg_match('#plugins/(.*?)/#',$matPlugins[1][$j],$wordpressId); $name = trim($matPlugins[2][$j],''); $found = false; foreach($results as $res){ if( $name == $res['Name'] ){ $found = true; break; } } if( ! $found ) $results[] = array( 'Name' => $name, 'Desc' => trim($matPlugins[3][$j]), 'Version' => '', 'LastUpdate'=> '', 'Id' => $wordpressId[1], 'Download' => 'http://downloads.wordpress.org/plugin/' . $wordpressId[1] . '.zip', 'PluginHome'=> trim($matPlugins[1][$j]), 'UpdateURL' => trim($matPlugins[1][$j]), 'Tags' => array($term), 'Rating' => '' ); } } wp_cache_set('wpupdate_searchPluginsWordpressOrg_'.rawurlencode($term), $results, 'wpupdate', 21600); //6*60*60=21600 $args['results'] = array_merge($args['results'],$results); return $args; } add_filter('wpupdate_pluginTagList','wpupdate_wordpressorg_taglist',1); function wpupdate_wordpressorg_taglist($tags){ $arrTags = wp_cache_get('wpupdate_searchPluginsWordpressOrg_TagList', 'wpupdate'); if( ! $arrTags ) { $snoopy = new Snoopy(); $snoopy->fetch('http://wordpress.org/extend/plugins/tags/'); preg_match_all("#(.*)#i",$snoopy->results,$arrTags); wp_cache_set('wpupdate_searchPluginsWordpressOrg_TagList', $arrTags, 'wpupdate', 43200); //12*60*60=43200 } for( $i = 0; $i < count($arrTags[0]); $i++){ $name = $arrTags[4][$i]; if( ! isset($tags[ $name ]) ) $tags[ $name ] = $arrTags[2][$i]; else $tags[ $name ] += $arrTags[2][$i]; } return $tags; } add_filter('wpupdate_pluginTagSearch','wpupdate_wordpressorg_tagsearch',1); function wpupdate_wordpressorg_tagsearch($args){ $results = wp_cache_get('wpupdate_pluginSearchTag_wordpressorg_'.$args['info']['terms'].'-'.$args['info']['page'], 'wpupdate'); if( ! $results ){ $url = 'http://wordpress.org/extend/plugins/tags/' . $args['info']['terms']; if( $args['info']['page'] > 1 ) $url .= '/page/' . $args['info']['page']; $snoopy = new Snoopy(); $snoopy->fetch($url); $results = array(); preg_match_all('#Design by (.*?)
#',$snoopy->results,$author); preg_match_all('##', $snoopy->results, $download); for($i=0; $i < count( $ids[1] ); $i++){ $themes[] = array( 'id' => $ids[1][$i], 'thumbnail' => 'http://wordpress.org' . $img[1][$i], 'name' => $name[1][$i], 'authorhomepage' => $author[1][$i], 'author' => $author[2][$i], 'download' => $download[1][$i] ); } wp_cache_set('wpupdate_wordpressorg_ThemesFeatured', $themes, 'wpupdate', 86400); //24*60*60=86400 } // end if (!$themes) if( $themes ) $args['results'] = array_merge($args['results'], (array)$themes); return $args; } ?>