Wp-Update Hooks/Filters

Hooks

Wpupdate_requirement-$type

For unsupported requirement types this hook is called, 4 arrays are passed via references within the array passed.

do_action('wpupdate_requirement-'.$reqInfo['Type'], array(&$pluginUpdateInfo, &$reqInfo, &$pluginCompatible,&$errors));

Filters

wpupdate_themeSearchProviders

This filter is called when searching for Themes, The filter function should expect a array to be passed of similar nature to the following, and return the same array(With its own search results tacked onto the ‘results’ section.

The values in the results array should follow the same as the format below:

array

  'results' =>

    array

      0 =>

        array

          'name' => string 'Cutline 3-Column Split           1.1' (length=28)

          'url' => string 'http://themes.wordpress.net/columns/3-columns/4415/cutline-3-column-split-11/' (length=77)

          'id' => string '4415' (length=4)

          'download' => string 'http://themes.wordpress.net/download.php?theme=4415' (length=51)

          'snapshot' =>

            array

              'thumb' => string 'http://s.themes.wordpress.net/snapshots/4415-thumb.jpg' (length=54)

              'medium' => string 'http://s.themes.wordpress.net/snapshots/4415-medium.jpg' (length=55)

              'big' => string 'http://s.themes.wordpress.net/snapshots/4415-big.jpg' (length=52)

          'testrun' => string 'http://themes.wordpress.net/testrun/?wptheme=4415' (length=49)

      1 =>

        array

          'name' => string 'NetWorker  1.0' (length=14)

          'url' => string 'http://themes.wordpress.net/columns/3-columns/4391/networker-10/' (length=64)

          'id' => string '4391' (length=4)

          'download' => string 'http://themes.wordpress.net/download.php?theme=4391' (length=51)

          'snapshot' =>

            array

              'thumb' => string 'http://s.themes.wordpress.net/snapshots/4391-thumb.jpg' (length=54)

              'medium' => string 'http://s.themes.wordpress.net/snapshots/4391-medium.jpg' (length=55)

              'big' => string 'http://s.themes.wordpress.net/snapshots/4391-big.jpg' (length=52)

          'testrun' => string 'http://themes.wordpress.net/testrun/?wptheme=4391' (length=49)

      2 =>

        array

          'name' => string 'Red Secret  0.1' (length=15)

          'url' => string 'http://themes.wordpress.net/columns/3-columns/4371/red-secret-01/' (length=65)

          'id' => string '4371' (length=4)

          'download' => string 'http://themes.wordpress.net/download.php?theme=4371' (length=51)

          'snapshot' =>

            array

              'thumb' => string 'http://s.themes.wordpress.net/snapshots/4371-thumb.jpg' (length=54)

              'medium' => string 'http://s.themes.wordpress.net/snapshots/4371-medium.jpg' (length=55)

              'big' => string 'http://s.themes.wordpress.net/snapshots/4371-big.jpg' (length=52)

          'testrun' => string 'http://themes.wordpress.net/testrun/?wptheme=4371' (length=49)

  'info' =>

    array

      'page' => int 1

      'pages' => int 20

      'searchOptions' =>

        array

          0 => string '3 columns' (length=9)

          1 => string 'Blue' (length=4)

      'sortby' => string 'date' (length=4)

      'order' => string 'DESC' (length=4)

      'andor' => string 'AND' (length=3)

wpupdate_themeSearchOptions

Function should accept an array similar to the below, and return the same array:

array
  'sections' => 
    array
      'Columns' => 
        array
          0 => string '1 column' (length=8)
          1 => string '2 columns' (length=9)
      'Colour' => 
        array
          0 => string 'Red' (length=3)
          1 => string 'Green' (length=5)
      'Advanced' => 
        array
          0 => string 'Plugins required' (length=16)
          1 => string 'Widget ready' (length=12)

There may be as many sections as wanted, and each section may contain as many items as they want. Long sections may be wrapped to multiple lines.

wpupdate_pluginSearchProviders, wpupdate_pluginTagSearch

Very similar to wpupdate_themeSearchProviders, Both take and return the same structure.

array
  'results' => 
    array
      0 => 
        array
          'Name' => string 'WP-Testimonials' (length=15)
          'Desc' => string 'Displays client testimonials in WordPress' (length=41)
          'Version' => string '' (length=0)
          'LastUpdate' => string '' (length=0)
          'Id' => string 'wp-testimonials' (length=15)
          'Download' => string 'http://downloads.wordpress.org/plugin/wp-testimonials.zip' (length=57)
          'PluginHome' => string 'http://wordpress.org/extend/plugins/wp-testimonials/' (length=52)
          'UpdateURL' => string 'http://wordpress.org/extend/plugins/wp-testimonials/' (length=52)
          'Tags' => 
            array
              0 => string 'test' (length=4)
          'Rating' => string '' (length=0)
      1 => 
        array
          'Name' => string 'Genki Feedburner SiteStats' (length=26)
          'Desc' => string 'Insert Feedburner SiteStats code (without Feeds Flare) for a speed boost' (length=72)
          'Version' => string '' (length=0)
          'LastUpdate' => string '' (length=0)
          'Id' => string 'genki-feedburner-sitestats' (length=26)
          'Download' => string 'http://downloads.wordpress.org/plugin/genki-feedburner-sitestats.zip' (length=68)
          'PluginHome' => string 'http://wordpress.org/extend/plugins/genki-feedburner-sitestats/' (length=63)
          'UpdateURL' => string 'http://wordpress.org/extend/plugins/genki-feedburner-sitestats/' (length=63)
          'Tags' => 
            array
              0 => string 'test' (length=4)
          'Rating' => string '' (length=0)
  'info' => 
    array
      'terms' => 
        array
          0 => string 'test' (length=4)
      'page' => int 1
      'pages' => int 1
 

wpupdate_update-url

This function is passed 2 parameters, 1 is the Update URL (Which may be blank), 2nd is the plugin Metadata

$pluginData['Update'] = apply_filters('wpupdate_update-url', $pluginData['Update'], $pluginData);

wpupdate_checkPluginUpdate-hostname.domain

While checking for an update for a given plugin, the data is retrieved via this filter.

If the URL is http://wordpress.org/extend/plugins/wp-update/ then the filter to get the information will be wpupdate_checkPluginUpdate-wordpress.org.

$components = parse_url($url);

$update = apply_filters('wpupdate_checkPluginUpdate-' . strtolower($components['host']), $url);

 

All these filters can be seen in action in the /wp-update/extensions/*.php files.