Example #1
0
 /**
  * Filter the package to add dist and other meta information.
  */
 function filterPackage(CompletePackage $package)
 {
     list($vendor, $shortName) = explode('/', $package->getName());
     // try to get the plugin info - may return an array or null/false
     try {
         $info = $this->getPluginInfo($shortName);
     } catch (RuntimeException $e) {
         if ($io->isVerbose()) {
             $io->writeError($e->getMessage());
         }
         // this allows us to try again for this plugin
         return;
     }
     if ($info) {
         // set the dist info
         $package->setDistType('zip');
         // strip out "tags", "trunk", slashes, and spaces
         $version = preg_replace('/tags|trunk|[\\/ ]/', '', $package->getSourceReference());
         // if there is a version identifier, prepend with a period
         $version = $version ? ".{$version}" : '';
         // set the dist url
         $package->setDistUrl('https://downloads.wordpress.org/plugin/' . urlencode($shortName . $version) . '.zip');
         // set some additional meta info
         // this is inconsequential to the solver, but it gets stored in composer.lock
         // and appears when running `composer show vendor/package`
         if (isset($info['short_description'])) {
             $package->setDescription($info['short_description']);
         }
         if (!empty($info['contributors'])) {
             $authors = [];
             foreach ($info['contributors'] as $name => $homepage) {
                 $authors[] = ['name' => $name, 'homepage' => $homepage];
             }
             $package->setAuthors($authors);
         }
         if (!empty($info['tags'])) {
             $package->setKeywords($info['tags']);
         }
         // URL-ready slug
         $pluginSlug = urlencode($shortName);
         $package->setSupport(['forum' => "https://wordpress.org/support/plugin/{$pluginSlug}/", 'source' => "http://plugins.trac.wordpress.org/browser/{$pluginSlug}/", 'docs' => "https://wordpress.org/plugins/{$pluginSlug}/"]);
         $package->setHomepage("https://wordpress.org/plugins/{$pluginSlug}/");
     } else {
         // null means the package is no longer active
         $package->setAbandoned(true);
     }
 }
 /**
  * Filter the package to add dist and other meta information.
  */
 function filterPackage(CompletePackage $package)
 {
     list($vendor, $shortName) = explode('/', $package->getName());
     if (($themeInfo = $this->getThemeInfo()) && isset($themeInfo[$shortName])) {
         $info = $themeInfo[$shortName];
         // set the dist info
         $package->setDistType('zip');
         $package->setDistUrl($info['download_uri']);
         // additional meta info
         $package->setDescription($info['description']);
         $package->setAuthors([['name' => $info['author'], 'homepage' => $info['author_uri']]]);
         $package->setHomepage($info['theme_uri']);
         // is this theme retired?
         if (in_array($shortName, $this->getRetiredThemes())) {
             $package->setAbandoned(true);
         }
     }
 }
Example #3
0
 static function filterPackage(CompletePackage $package)
 {
     // strip out "tags", slashes, and spaces
     $version = preg_replace('/tags|[\\/ ]/', '', $package->getSourceReference());
     // trunk does not have a dist version
     if ($version !== 'trunk') {
         // set the dist info
         $package->setDistType('zip');
         // if there is a version identifier, prepend with a period
         $version = "-{$version}";
         // set the dist url
         $package->setDistUrl('https://wordpress.org/wordpress' . urlencode($version) . '.zip');
     }
     // set some additional meta info
     // this is inconsequential to the solver, but it gets stored in composer.lock
     // and appears when running `composer show vendor/package`
     $package->setDescription('WordPress is web software you can use to create a beautiful website, blog, or app.');
     $package->setSupport(['forum' => 'https://wordpress.org/support/', 'source' => 'https://core.trac.wordpress.org/browser/' . $package->getSourceReference(), 'docs' => 'https://codex.wordpress.org/Main_Page']);
     $package->setHomepage('https://wordpress.org/');
 }
Example #4
0
 /**
  * Add some package meta info.
  */
 static function filterPackage(CompletePackage $package)
 {
     // set the VIP plugins landing page as the homepage as some do not have individual overview pages
     $package->setHomepage('https://vip.wordpress.com/plugins/');
 }
Example #5
0
 static function filterPackage(CompletePackage $package)
 {
     $package->setHomepage('https://wordpress.org/');
     $package->setDescription('WordPress develop repo offering source files, unit tests, and i18n tools.');
 }